| 1 |
argon2: Argon2 key derivation algorithm family support |
| 2 |
|
| 3 |
This module provides an implementation of the argon2 key derivation function as |
| 4 |
described by RFC 9106. This is the recommended algorithm for password hashing in |
| 5 |
Hare programs, and for deriving keys for use with other cryptographic |
| 6 |
algorithms. Some thought must be given to the appropriate configuration for your |
| 7 |
use case. Some general advice is provided here; if in doubt, consult the RFC. |
| 8 |
|
| 9 |
The argon2 parameters are configured via the [[conf]] structure. To determine |
| 10 |
the appropriate configuration parameters for a particular use-case, consult |
| 11 |
section 4 of the RFC. Otherwise, sane defaults for common scenarios are provided |
| 12 |
via [[default_conf]] and [[low_mem_conf]]; consult the docs of each |
| 13 |
configuration for details. |
| 14 |
|
| 15 |
Once a suitable configuration has been selected, the user must provide a salt. |
| 16 |
This salt should be stored alongside the hash, should be unique for each |
| 17 |
password, and should be random: see [[crypto::random::]]. The salt and hash |
| 18 |
lengths are configurable, the recommended defaults are 16 and 32 bytes |
| 19 |
respectively. |
| 20 |
|
| 21 |
Equipped with the necessary parameters, the user may call the appropriate argon2 |
| 22 |
variant via [[argon2d]], [[argon2i]], or [[argon2id]]. If unsure which to use, |
| 23 |
choose [[argon2id]]. The RFC is the authoratative source on the appropriate |
| 24 |
argon2 variant and configuration parameters for your use-case. |
| 25 |
|
| 26 |
This is a low-level module which implements cryptographic primitives. Direct use |
| 27 |
of cryptographic primitives is not recommended for non-experts, as incorrect use |
| 28 |
of these primitives can easily lead to the introduction of security |
| 29 |
vulnerabilities. Non-experts are advised to use the high-level operations |
| 30 |
available in the top-level [[crypto::]] module. |
| 31 |
|
| 32 |
Be advised that Hare's cryptography implementations have not been audited. |