Created
July 10, 2014 20:24
-
-
Save IrakliJani/6d1d61a959286501a66a to your computer and use it in GitHub Desktop.
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
'use strict'; | |
var crypto = require('crypto'); | |
exports.generate_signature = function (params, api_secret) { | |
var sorted = []; | |
var pre_sig; | |
Object.keys(params).sort().forEach(function (key) { | |
sorted.push([key, params[key]].join('=')); | |
}); | |
pre_sig = sorted.join('') + api_secret; | |
return crypto.createHash('md5').update(pre_sig).digest('hex'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment