This is a fork of node-argon2 that is using crypto.argon2 implementation as described in #469
It can be used with node >= 24.7.0
It's possible to hash using either Argon2i, Argon2d or Argon2id (default), and verify if a password matches a hash.
To hash a password:
import * as argon2 from '@pirxpilot/argon2';
try {
const hash = await argon2.hash("password");
} catch (err) {
//...
}To verify a password:
try {
if (await argon2.verify("<big long hash>", "password")) {
// password match
} else {
// password did not match
}
} catch (err) {
// internal failure
}Note
By default, argon2.hash will generate secure hashes according to the security recommendations by the team that develops Argon2. For password hashing, there is no need to modify them.
To see how you can modify the output (hash length, encoding) and parameters (time cost, memory cost and parallelism), read the wiki
This project exists thanks to all the people who contribute. [Contribute].
Become a financial contributor and help us sustain our community. [Contribute]
Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]
Work licensed under the MIT License. Please check P-H-C/phc-winner-argon2 for license over Argon2 and the reference implementation.