I am migrating a php script to node and I know little about encryption.
The php script uses this function:
hash_hmac('sha512', text, key);
So, I need to implement a function in Node js to return a hash key using the hmac method (SHA512).
From what I see, Node has this functionality built in through the crypto module ( http://nodejs.org/docs/latest/api/crypto.html#crypto_crypto ) - But I'm not clear how to reproduce this function.
Any help would be appreciated.
Thank,
Yes, use the cryptographic library.
var hash = crypto.createHmac('sha512', key); hash.update(text); var hashed_data = hash.digest();
(, hash.digest) , .
hash.digest
, , (.. hash crypto.createHmac.)
hash
crypto.createHmac