Skip to content

Instantly share code, notes, and snippets.

@manjeshpv
Created November 11, 2016 04:45
Show Gist options
  • Save manjeshpv/77026b67e74741d4a33ca37333405714 to your computer and use it in GitHub Desktop.
Save manjeshpv/77026b67e74741d4a33ca37333405714 to your computer and use it in GitHub Desktop.
function qChecksum (o, algorithm, encoding) {
const obj = o; console.log(o)
if (typeof obj !== Object && !obj.body && _.empty(obj)) return obj;
obj.c = crypto.createHmac(algorithm || 'sha256', HMACSECRET)
.update(JSON.stringify(o.body), 'utf8')
.digest(encoding || 'hex');
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment