Last active
June 15, 2023 21:35
-
-
Save nolim1t/e260aaddfe9b6d3cb6ab to your computer and use it in GitHub Desktop.
node.js HMAC SHA512 signing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Example code