Skip to content

Instantly share code, notes, and snippets.

@bartt
Created November 4, 2010 19:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save bartt/663052 to your computer and use it in GitHub Desktop.
Hmac digest only returns a digest once?
crypto = require('crypto');
hmac = crypto.createHmac('sha256', 'hackme');
hmac.update('bladibla');
hmac.digest('hex'); // '6a405c5f6fe96680a57054cee8a4a74356c2df1b5e5cf8102dac3773af713418'
hmac.digest('hex'); // '' -- Hûh?!
hmac.update('bladibla');
hmac.digest('hex'); // '' -- Hûh?! Again?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment