argon2_elixir v1.1.0 Argon2.Stats View Source
Module to provide statistics for the Argon2 password hashing function.
The default parameters are:
- t_cost: 6
- m_cost: 16 (64 MiB of memory)
- parallelism: 1
However, the parameters you use depend a lot on the hardware you are using, and so it is important to measure the function’s running time and adjust the parameters accordingly.
Below is a guide on how to choose the parameters and what kind of running time is recommended.
Choosing parameters
- Decide how much memory the function should use
- Decide how many threads to use
Set the t_cost to 3 and measure the time it takes to hash a password
- If the function is too slow, reduce memory usage, but keep t_cost at 3
- If the function is too fast, increase the t_cost
For online use - for example, logging in on a website - the function should take anything between 250 milliseconds and one second. For a desktop application, the function could take longer, anything from several seconds to 5 seconds, as long as the user only has to log in once per session. These numbers are based on the libsodium documentation for Argon2i and NIST recommendations (the NIST recommendations are currently being reviewed).
Link to this section Summary
Functions
Hash a password with Argon2 and print out a report
Link to this section Functions
Hash a password with Argon2 and print out a report.
This function hashes the password and salt with Argon2.Base.hash_password/3 and prints out statistics which can help you choose how to configure Argon2.