Skip to content

Instantly share code, notes, and snippets.

@questsin
Created February 20, 2019 14:59
Show Gist options
  • Save questsin/8255c4d4eb29e6f7f20269f2667e5b52 to your computer and use it in GitHub Desktop.
Save questsin/8255c4d4eb29e6f7f20269f2667e5b52 to your computer and use it in GitHub Desktop.
var CryptoJS = require("crypto-js");
console.log(CryptoJS.HmacSHA1("Message", "Key"));
// Encrypt
var ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123');
// Decrypt
var bytes = CryptoJS.AES.decrypt(ciphertext.toString(), 'secret key 123');
var plaintext = bytes.toString(CryptoJS.enc.Utf8);
console.log(plaintext);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment