for the node.js crypto command:
crypto.createHmac('this is a test', key);
What is node expecting for key
's encoding?
utf8? a binary buffer?
Information Security Stack Exchange is a question and answer site for information security professionals. It only takes a minute to sign up.
Sign up to join this communitySince javascript uses UTF-16 strings, I suspect it is expecting a UTF-16 encoded string. Just to clarify, your first parameter should be a hash algorithm ('sha1', 'md5', etc.) not the data to be encrypted.
First parameter should be the algorythm, not the input to be HMACed, should be one of the following -
MD5
SHA
SHA1
SHA256
SHA384
The key is a secret / salt string.
crypto.createHmac returns a stream, you write your input into it and once you start reading, it returns the computed digests.