Skip to content

Commit d225642

Browse files
authored
Add comparison with node:crypto and clarify parameter usage in README.md (#491)
* Clarify default settings for Argon2 password hashing * Update README with argon2 and node:crypto comparison
1 parent e3a4a7b commit d225642

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

README.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ try {
2222
}
2323
```
2424

25-
To see how you can modify the output (hash length, encoding) and parameters
26-
(time cost, memory cost and parallelism),
27-
[read the wiki](https://github.com/ranisalt/node-argon2/wiki/Options)
28-
2925
To verify a password:
3026
```js
3127
try {
@@ -39,6 +35,28 @@ try {
3935
}
4036
```
4137

38+
> [!NOTE]
39+
> By default, argon2.hash will generate secure hashes according to the security recommendations by the team that develops Argon2.
40+
> **For password hashing, there is no need to modify them.**
41+
42+
To see how you can modify the output (hash length, encoding) and parameters
43+
(time cost, memory cost and parallelism),
44+
[read the wiki](https://github.com/ranisalt/node-argon2/wiki/Options)
45+
46+
### Comparison with the node:crypto native implementation
47+
48+
The native API is focused towards generic usage of the Argon2 hash function, while this package historically focused on password hashing.
49+
50+
Once all supported Node releases include native Argon2 and older versions are officially EOL, node-argon2 will transition into a minimal wrapper. It will offer the most developer-friendly interface, bridging users to Node's native crypto methods. This avoids duplication and ensures seamless upgrades once native support is universal.
51+
52+
| | node-argon2 | node:crypto argon2 |
53+
|------------------------------------------------------------------------------------------------------------------- |------------- |-------------------- |
54+
| Generate hashes |||
55+
| [PHC string formatting](https://github.com/P-H-C/phc-string-format/blob/master/phc-sf-spec.md) |||
56+
| Verify PHC string |||
57+
| Check if re-hash is needed |||
58+
| [Provide sensible default parameters](https://github.com/ranisalt/node-argon2/issues/469#issuecomment-3452416217) |||
59+
4260
### Migrating from another hash function
4361
See [this article on the wiki](https://github.com/ranisalt/node-argon2/wiki/Migrating-from-another-hash-function) for steps on how to migrate your existing code to Argon2. It's easy!
4462

0 commit comments

Comments
 (0)