我似乎无法让CryptoJS.AES正确解密它加密的内容。请看这个javascript代码:
var plaintext = "Message";
var encrypted = CryptoJS.AES.encrypt(plaintext, "Secret Passphrase");
var decrypted = CryptoJS.AES.decrypt(encrypted, "Secret Passphrase");
console.log(plaintext);
console.log(encrypted.toString());
console.log(decrypted.toString());
结果输出
Message
U2FsdGVkX18Y2Cs77gkggFx8fkEajT1uztVYRkSkt/E
4d657373616765
为什么我没有找回原来的"Message"
?
答案 0 :(得分:3)
decrypted.toString(CryptoJS.enc.Utf8)