Skip to content

Instantly share code, notes, and snippets.

Last active Jul 19, 2022
What would you like to do?
node.js HMAC SHA512 signing
var crypto = require("crypto");
function encrypt(key, str) {
var hmac = crypto.createHmac("sha512", key);
var signed = hmac.update(new Buffer(str, 'utf-8')).digest("base64");
return signed
Copy link

nolim1t commented Aug 6, 2015

Example code

console.log(encrypt("test", "hello world"));
console.log(encrypt("test", "goodbye world"));

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