mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 00:24:47 -07:00
Add ESLint & Run it against the system (#4470)
This commit is contained in:
parent
43eee6b32e
commit
f789e02096
106 changed files with 1235 additions and 20242 deletions
|
|
@ -5,22 +5,22 @@ const HASH_ROUNDS = 1_000;
|
|||
const SALT_LENGTH = 16;
|
||||
|
||||
export const hashPassword = (salt: string, password: string): string => {
|
||||
let hashedPassword = salt + password;
|
||||
for (let i = 0; i < HASH_ROUNDS; i++) {
|
||||
// WHY DO WE DO IT THIS WAY?
|
||||
hashedPassword = sha512(hashedPassword);
|
||||
}
|
||||
let hashedPassword = salt + password;
|
||||
for (let i = 0; i < HASH_ROUNDS; i++) {
|
||||
// WHY DO WE DO IT THIS WAY?
|
||||
hashedPassword = sha512(hashedPassword);
|
||||
}
|
||||
|
||||
return salt + Base64.stringify(hashedPassword);
|
||||
return salt + Base64.stringify(hashedPassword);
|
||||
};
|
||||
|
||||
export const generateSalt = (): string => {
|
||||
const characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||
const characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
||||
|
||||
let salt = "";
|
||||
for (let i = 0; i < SALT_LENGTH; i++) {
|
||||
salt += characters.charAt(Math.floor(Math.random() * characters.length));
|
||||
}
|
||||
let salt = '';
|
||||
for (let i = 0; i < SALT_LENGTH; i++) {
|
||||
salt += characters.charAt(Math.floor(Math.random() * characters.length));
|
||||
}
|
||||
|
||||
return salt;
|
||||
}
|
||||
return salt;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue