Skip to content

Instantly share code, notes, and snippets.

@lukehedger
Created August 11, 2014 11:33
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 lukehedger/9480d82c6212a5ec163d to your computer and use it in GitHub Desktop.
Save lukehedger/9480d82c6212a5ec163d to your computer and use it in GitHub Desktop.
AES encryption with CryptoJS and Browserify
# Include Crypto JS modules as required
CryptoJS = require 'crypto-js'
AES = require 'crypto-js/aes'
# then use like so:
str = "Message to encrpyt"
passcode = "wu gang chops the tree"
hash = AES.encrypt(str, passcode).ciphertext.toString(CryptoJS.enc.Base64) # => hI524rbTeezmKq9BSl1b0ZOtgGAu+4y8X4FAk/VAMh8=
@lukehedger
Copy link
Author

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