Skip to content

Instantly share code, notes, and snippets.

@mcpeblocker
Created September 16, 2022 17:57
Show Gist options
  • Save mcpeblocker/b19c0ae7e5aced793fc888291d051f8f to your computer and use it in GitHub Desktop.
Save mcpeblocker/b19c0ae7e5aced793fc888291d051f8f to your computer and use it in GitHub Desktop.
Generate SHA1 Hash for OpenBudget validation using phone and application id.
const crypto = require("crypto");
/*
t = {
phone: "+998 (99) 345-12-12",
application: "128222"
}
*/
function generateKey(t) {
var e = "",
n = crypto.createHash("sha1");
for (var o in t) e += "".concat(o, ":").concat(t[o]);
return (
(e = "".concat(e, "_").concat("gxmo2RTwVMxCBOha22TusE8sItJdiyHj")),
n.update(e),
n.digest("hex")
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment