mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-02-03 12:47:35 +01:00
Switch password hashing function to scrypt
This commit is contained in:
parent
716d1fc988
commit
59657766b5
@ -40,7 +40,7 @@ const STORAGE_KEYS = {
|
||||
* @property {string} handle - The user's short handle. Used for directories and other references
|
||||
* @property {string} name - The user's name. Displayed in the UI
|
||||
* @property {number} created - The timestamp when the user was created
|
||||
* @property {string} password - SHA256 hash of the user's password
|
||||
* @property {string} password - Scrypt hash of the user's password
|
||||
* @property {string} salt - Salt used for hashing the password
|
||||
* @property {boolean} enabled - Whether the user is enabled
|
||||
* @property {boolean} admin - Whether the user is an admin (can manage other users)
|
||||
@ -372,13 +372,13 @@ function getCookieSessionName() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Hashes a password using SHA256.
|
||||
* Hashes a password using scrypt with the provided salt.
|
||||
* @param {string} password Password to hash
|
||||
* @param {string} salt Salt to use for hashing
|
||||
* @returns {string} Hashed password
|
||||
*/
|
||||
function getPasswordHash(password, salt) {
|
||||
return crypto.createHash('sha256').update(password + salt).digest('hex');
|
||||
return crypto.scryptSync(password.normalize(), salt, 64).toString('base64');
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user