Re: using .read() on a crypto hash

20 views
Skip to first unread message

Stanislas Marion

unread,
May 16, 2013, 8:13:29 AM5/16/13
to nod...@googlegroups.com
apparently I need to call hmac.end() before reading

On Thursday, May 16, 2013 1:29:18 PM UTC+2, Stanislas Marion wrote:
Hi,

I'm trying to use write and read instead of update and digest as per the doc's recommendations but I can't make it work:

function createHmac (b64secret, message) {
  var hmac = crypto.createHmac('sha512', b64secret);
  hmac.write(message);
  return hmac.read();
}

console.log(createMtGoxHmac(b64secret, new Buffer('Test\0Message')));

this returns null

where am I doing it wrong?
Reply all
Reply to author
Forward
0 new messages