Click here to Skip to main content
15,888,286 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
why the decryption result is not right?
JavaScript
var encrypted = CryptoJS.AES.encrypt("faizan", "sp");
    alert(encrypted);
    var decrypted = CryptoJS.AES.decrypt(encrypted, "sp");
    alert(decrypted);


using https://code.google.com/p/crypto-js/[^]
Posted

1 solution

If you read the documentation at the link you gave, you will see that the return from decrypt is NOT a string.
Try using
JavaScript
alert(decrypted.toString(CryptoJS.enc.Utf8));
just as the example does.
 
Share this answer
 
Comments
Muhamad Faizan Khan 5-May-15 0:20am    
thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900