Browse Source

prox

master
zeus 4 years ago
parent
commit
b51d568b99
  1. 4
      swarmlab-app/src/run/app.js

4
swarmlab-app/src/run/app.js

@ -430,13 +430,13 @@ cors(corsOptions), (req, res, next) => {
//function getSHA256ofJSON(input){ //function getSHA256ofJSON(input){
// return require("crypto").createHash("sha256").update(JSON.stringify(input)).digest("hex"); // return require("crypto").createHash("sha256").update(JSON.stringify(input)).digest("hex");
//} //}
const getSHA256ofJSON = (data: string, inputEncoding, encoding) => { function getSHA256ofJSON(data, inputEncoding, encoding){
if (!data) { if (!data) {
return ''; return '';
} }
inputEncoding = inputEncoding || 'utf-8'; inputEncoding = inputEncoding || 'utf-8';
encoding = encoding || 'hex'; encoding = encoding || 'hex';
const hash = crypto.createHash('md5'); const hash = require("crypto").createHash('md5');
return hash.update(JSON.stringify(data), inputEncoding).digest(encoding); return hash.update(JSON.stringify(data), inputEncoding).digest(encoding);
} }

Loading…
Cancel
Save