View difference between Paste ID: T0L7ZT1b and LcDBG7yj
SHOW: | | - or go back to the newest paste.
1
load( 'rollups/aes.js' );
2
load( 'components/pad-ansix923.js' );
3
4-
var data = "hello! this is a test!";
4+
var data = "08/24/1990";
5-
var key = '59b6ab46d379b89d794c87b74a511fbd59b6ab46d379b89d794c87b74a511fbd';
5+
var key = 'LM@098765_AVPAppLM@098765_AVPApp';
6-
var iv = '0aaff094b6dc29742cc98a4bac8bc8f9';
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) + ']');