Advertisement
Guest User

Untitled

a guest
Dec 3rd, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. load( 'rollups/aes.js' );
  2. load( 'components/pad-ansix923.js' );
  3.  
  4. var data = "08/24/1990";
  5. var key = 'LM@098765_AVPAppLM@098765_AVPApp';
  6. var iv = 'e95a3d73fe601926';
  7.  
  8. var encrypted = CryptoJS.AES.encrypt(CryptoJS.enc.Utf8.parse(data), CryptoJS.enc.Hex.parse(key), { iv: CryptoJS.enc.Hex.parse(iv) });
  9.  
  10. print( 'Ciphertext: [' + encrypted.ciphertext + ']' );
  11. print( 'Key:        [' + encrypted.key + ']' );
  12.  
  13. cipherParams = CryptoJS.lib.CipherParams.create({ciphertext: CryptoJS.enc.Hex.parse(encrypted.ciphertext.toString())});
  14. var decrypted = CryptoJS.AES.decrypt(cipherParams, CryptoJS.enc.Hex.parse(key), { iv: CryptoJS.enc.Hex.parse(iv) });
  15.  
  16. print( 'Cleartext:  [' + decrypted.toString(CryptoJS.enc.Utf8) + ']');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement