Scrypt
Provides methods for hashing passwords and verifying hashes with scrypt. By default, the configuration is set to the recommended values.
We recommend using Argon2id
if possible.
Implements PasswordHashingAlgorithm
.
Constructor
function constructor(options?: { N?: number; r?: number; p?: number; dkLen?: number }): this;
Parameters
options
N
(default:16384
)r
(default:16
)p
(default:1
)dkLen
(default:64
)
Methods
Example
import { Scrypt } from "oslo/password";
const scrypt = new Scrypt();
const hash = await scrypt.hash(password);
const validPassword = await scrypt.verify(hash, password);