What is the real value of WordArray when it is used as an AES key?

Viewed 67
var CryptoJS = require("crypto-js");

let key = "nfu-eca-EBLrKCb3AUu*X%3+lh7=o2jUmhp1(z&6";
let username = "01032219";

let result = CryptoJS.AES.encrypt(username, CryptoJS.MD5(key), {
  mode: CryptoJS.mode.ECB,
  padding: CryptoJS.pad.Pkcs7,
});

console.log(result.toString()); 
// output: 1oIadjvmeIeH/UGd5QPCvg==

As you can see, I use CryptoJS to encrypt the username. I'm confused about CryptoJS.MD5(key). It is a WordArray object, what is its real value when it is passed to the CryptoJS.AES.encrypt() function as an AES encryption key?

I tried to reproduce the encryption process of the above code at the AES online encryption site.

  • plain text to be encrypted: "01032219"
  • cipher mode: ECB
  • padding: PKCS7

I fill in the MD5(include 16/32-bit lowercase/uppercase) of the same key string("nfu-eca-EBLrKCb3AUu*X%3+lh7=o2jUmhp1(z&6") as Secret Key. But the final result is not the same as the output of the code.

0 Answers
Related