Created
February 5, 2017 18:27
-
-
Save yetanotherchris/99f107d6ead03d467ea61b00456d41a7 to your computer and use it in GitHub Desktop.
Stanford Javascript Crypto Library basic AES example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Basic AES example using the defaults. | |
// https://github.com/bitwiseshiftleft/sjcl | |
var password = "password"; | |
var text = "my secret text"; | |
var parameters = { "iter" : 1000 }; | |
var rp = {}; | |
var cipherTextJson = {}; | |
sjcl.misc.cachedPbkdf2(password, parameters); | |
cipherTextJson = sjcl.encrypt(password, text, parameters, rp); | |
console.log(cipherTextJson); | |
var decryptedText = sjcl.decrypt(password, cipherTextJson) | |
console.log(decryptedText); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment