backup
This commit is contained in:
1 parent
46e9a54a20
commit
04773e50fc
10 files changed
+127
-38
No files matched your search
@@ -0,0 +1,32 @@
|
||||
const saltMaster = "xG7t;a$LN=D5";
|
||||
const saltAdmin = "mXA4H_xb$g)c";
|
||||
|
||||
function hash(m, salt) {
|
||||
var result = "";
|
||||
if (m.length != 24) throw "Invalid id";
|
||||
for (var i = 0; i < 12; i++) {
|
||||
//console.log(x.charAt(i));
|
||||
playground = 0;
|
||||
playground += salt.charCodeAt(i);
|
||||
playground ^= m.charCodeAt(i);
|
||||
playground ^= m.charCodeAt(i + 12);
|
||||
playground &= 0xff;
|
||||
playground %= 10;
|
||||
result += playground.toString();
|
||||
}
|
||||
// console.log(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
function getKeys(uid) {
|
||||
var keys;
|
||||
try {
|
||||
keys = {
|
||||
User: hash(uid, saltMaster),
|
||||
Admin: hash(uid, saltAdmin),
|
||||
};
|
||||
} catch (error) {
|
||||
keys = { err: "Invalid id" };
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
Reference in new issue
Block a user