Skip to content

Instantly share code, notes, and snippets.

@scottgonzalez
Created July 21, 2010 23:21
Show Gist options
  • Save scottgonzalez/485299 to your computer and use it in GitHub Desktop.
Save scottgonzalez/485299 to your computer and use it in GitHub Desktop.
var crypto = require('crypto');
["sha1", "md5", "sha256", "sha512", "ripemd160"].forEach(function(algo) {
exports[algo] = function(data, salt) {
return (typeof salt != 'undefined' ?
crypto.createHmac(algo, salt) :
crypto.createHash(algo)
).update(data).digest("hex");
};
});
@isaacs
Copy link

isaacs commented Jul 22, 2010

Oh my god, you totally took my non-open-source proprietary IM and open sourced it on github.

You are so super sued.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment