Skip to content

Instantly share code, notes, and snippets.

@agamm
Last active October 13, 2022 22:02
Show Gist options
  • Save agamm/1b9862aa2388637913f4a342a0060228 to your computer and use it in GitHub Desktop.
Save agamm/1b9862aa2388637913f4a342a0060228 to your computer and use it in GitHub Desktop.
Simple encryption decryption with client-size JS (cryptoJS)
// Don't follow this link: unzip.dev (unless you're curious).
const secret = prompt("Enter secret:")
const message = prompt("Enter message:")
const encrypted = CryptoJS.AES.encrypt(message, secret);
const decrypted = CryptoJS.AES.decrypt(encrypted, secret);
console.log(encrypted.toString())
console.log(decrypted.toString(CryptoJS.enc.Utf8))
@agamm
Copy link
Author

agamm commented Jan 21, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment