-
-
Save alexey-sh/73fc63b6bf2427cc6e890a79766976e4 to your computer and use it in GitHub Desktop.
Revisions
-
nolim1t revised this gist
Aug 6, 2015 . 1 changed file with 1 addition and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,4 @@ function encrypt(key, str) { var hmac = crypto.createHmac("sha512", key); var signed = hmac.update(new Buffer(str, 'utf-8')).digest("base64"); return signed } -
nolim1t created this gist
Aug 6, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ 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 } // Samples console.log(encrypt("test", "hello world")); console.log(encrypt("test", "goodbye world"));