javascript - Decrypt in Crypto-JS gives numeric hexadecimal output instead of original plaintext string -
I have been using the example of examples put a simple test:
Page header: < / P>
& lt; Script src = "http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js" & gt; & Lt; / Script & gt; In a JavaScript function:
var encrypted = Kriptojesh.as.ansiript ( "Message", "secret passphrase"); Var decrypted = CryptoJS.AES.decrypt (encrypted, "secret passphrase"); Warning ('encrypted:' + encrypted + 'decrypted:' + decrypted); But the output is:
encrypted: U2FsdGVkX19hsNqFBS5xcUoVBCu / hPHepEwZchqnUVU = decrypted: 4d657373616765
div class = "post-text" itemprop = "text">
Dekryptedktostring (Kriptojaskinkkutf8) // See "Message"
The hash that you come back is not a string yet. It is a WordArray object when you use WordArray object in a string context, it is automatically converted into a hex string. You Other toString method called clearly and encoder < / Blockquote>
Comments
Post a Comment