Skip to content

Instantly share code, notes, and snippets.

@IrakliJani
Created July 10, 2014 20:24
Show Gist options
  • Save IrakliJani/6d1d61a959286501a66a to your computer and use it in GitHub Desktop.
Save IrakliJani/6d1d61a959286501a66a to your computer and use it in GitHub Desktop.
'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