简体   繁体   中英

How to Decrypt the encrypted string using CryptoJS (SHA512)

I am using CrypstoJS ( from https://code.google.com/p/crypto-js ) for the encryption and decryption.

I encrypted a string as shown below:

var hash = CryptoJS.HmacSHA512("Message", "Secret Passphrase");

Then how to decrypt it??? I want to use SHA512 for encryption/decryption.

Please help me..

From the documentation:

Keyed-hash message authentication codes (HMAC) is a mechanism for message authentication using cryptographic hash functions.

You can't decrypt it. It is hashed, not encrypted.


If you want to decrypt your data, then use a cipher function instead of a hash function.


That said, most of the time, when people want to do encryption/decryption with JavaScript, they should be using SSL instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM