0

Can anyone help me with this problem please.

I am trying to use the follwing code to generate a HMAC digest, but crypto module in node doesnt appear to return the correct signature?

var ipnStr = 'b2b3493a-ef96-4eea-853e-3fd82491a4100.00241BTCCOMPLETED';
var secret = 'lB6E2Um6hitYosCd4J9zTNBZKcKHLiJvGqfab4VKh0E';
var signature = crypto.createHmac('sha256', secret).update(ipnStr).digest('hex');

Signtaure should return:

7184c8edefa057d6c25bf750db4652dd261e36c350f2a17c410c24524ea210f1

But Im getting a completely different string, it works on the follwing website:

http://www.freeformatter.com/hmac-generator.html

Any ideas? Am I missing something?

Thanks.

* UPDATE *

I have solved the issue, turns out I was generating the secret incorrectly and I am now getting the correct signature.

gevorg
  • 4,835
  • 4
  • 35
  • 52
rjmacarthy
  • 2,164
  • 1
  • 13
  • 22

0 Answers0