forked from Hri7566/mpp-server-dev2
Fix ID hashing and add color generator
This commit is contained in:
parent
e8f1453eed
commit
025dbf0ebb
|
@ -6,5 +6,21 @@ export function createID() {
|
|||
}
|
||||
|
||||
export function createUserID(ip: string) {
|
||||
return createHash("sha-256").update(ip).update(env.SALT).digest("hex");
|
||||
return createHash("sha256")
|
||||
.update(ip)
|
||||
.update(env.SALT)
|
||||
.digest("hex")
|
||||
.substring(0, 24);
|
||||
}
|
||||
|
||||
export function createColor(ip: string) {
|
||||
return (
|
||||
"#" +
|
||||
createHash("sha256")
|
||||
.update(ip)
|
||||
.update(env.SALT)
|
||||
.update("color")
|
||||
.digest("hex")
|
||||
.substring(0, 6)
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue