3 ms·
Yes, scrypt-kdf works great: const scryptParams = { logN: 15, r: 8, p: 1 }; async function hashPassword(password: string): Promise<string> { const
by phiresky 6y ago
Yes, scrypt-kdf works great:
const scryptParams = { logN: 15, r: 8, p: 1 };
async function hashPassword(password: string): Promise<string> {
const password_hash: Buffer = await scrypt.kdf(password, scryptParams);
return password_hash.toString("base64");
}
async function verifyPassword(hash, password): Promise<boolean> {
return await scrypt.verify(Buffer.from(hash, "base64"), password);
}