1

Guys how is it possible that crypto produces the following hash

console.log(crypto.createHmac('md5', 'key').update('value').digest('hex'))
01433efd5f16327ea4b31144572c67f6

whereas node-forge produces incorrect one, however works fine for SSL calculation

let md5 = forge.hmac.create()
md5.start('MD5', 'key')
md5.update('value')
console.log(Buffer.from(md5.digest().data).toString('hex'))

01433ec3bd5f16327ec2a4c2b31144572c67c3b6

openssl produces the same output as crypto

echo -n "value" | openssl dgst -md5 -hmac "key"
01433efd5f16327ea4b31144572c67f6
Ouveaus
  • 31
  • 3

0 Answers0