Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- load( 'rollups/aes.js' );
- load( 'components/pad-ansix923.js' );
- var data = "hello! this is a test!";
- var key = '59b6ab46d379b89d794c87b74a511fbd59b6ab46d379b89d794c87b74a511fbd';
- var iv = '0aaff094b6dc29742cc98a4bac8bc8f9';
- var encrypted = CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(data), CryptoJS.enc.Hex.parse(key), { iv: CryptoJS.enc.Hex.parse(iv) });
- print( 'Ciphertext: [' + encrypted.ciphertext + ']' );
- print( 'Key: [' + encrypted.key + ']' );
- cipherParams = CryptoJS.lib.CipherParams.create({ciphertext: CryptoJS.enc.Hex.parse(encrypted.ciphertext.toString())});
- var decrypted = CryptoJS.AES.decrypt(cipherParams, CryptoJS.enc.Hex.parse(key), { iv: CryptoJS.enc.Hex.parse(iv) });
- print( 'Cleartext: [' + decrypted.toString(CryptoJS.enc.Utf8) + ']');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement