Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@blasterpal
Created December 23, 2019 18:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blasterpal/289458e253f286fa6624fde42c930021 to your computer and use it in GitHub Desktop.
Save blasterpal/289458e253f286fa6624fde42c930021 to your computer and use it in GitHub Desktop.
enc-dec-crypto-example
/ Encrypt
const ciphertext = CryptoJS.AES.encrypt('a8f0840ce2388', process.env.JWT_SECRET);
console.log('ciphertext', ciphertext.toString());
// // Decrypt
const plaintext = CryptoJS.AES.decrypt(ciphertext.toString(), process.env.JWT_SECRET).toString(CryptoJS.enc.Utf8);
console.log('plaintext', plaintext);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment