|
22 | 22 | } |
23 | 23 | ``` |
24 | 24 |
|
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 | | - |
29 | 25 | To verify a password: |
30 | 26 | ```js |
31 | 27 | try { |
|
39 | 35 | } |
40 | 36 | ``` |
41 | 37 |
|
| 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 | + |
42 | 60 | ### Migrating from another hash function |
43 | 61 | 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! |
44 | 62 |
|
|
0 commit comments