A super simple (but secure) encryption and decryption of text using aes-256-cbc
algorithm with a 32 bytes secret.
By design the hash doesn't change at every encryptation, so don't use this lib to encrypt passwords.
npm i crypty
or
yarn add crypty
import { encrypt, decrypt } from 'crypty'
// Your secret must have 32 bytes.
const secret = 'P10PJY1ckcMEeZxWHfVzsiOktuXf8O8O'
const hash = encrypt('my text', secret)
// => 46e2a7e3214f127c198247332cdc89ce
const text = decrypt(hash, secret)
// => 'my text'
Based on node-crypto-examples from @chris-rock.