Skip to content

Instantly share code, notes, and snippets.

@einnar82
Created August 25, 2021 13:14
Show Gist options
  • Save einnar82/f536788d57a149a7adee494ce24f70fb to your computer and use it in GitHub Desktop.
Save einnar82/f536788d57a149a7adee494ce24f70fb to your computer and use it in GitHub Desktop.
HMAC SHA512 Encryption
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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment