argon2_elixir v0.11.0 Argon2.Base
Lower-level api for Argon2.
These functions can be useful if you want more control over some of the options. In most cases, you will not need to call these functions directly.
Summary
Functions
Hash a password using Argon2
Functions
hash_nif(t_cost, m_cost, parallelism, password, salt, raw, hashlen, encodedlen, argon2_type, argon2_version)
Hash a password using Argon2.
Configurable parameters
The following three parameters can be set in the config file:
t_cost - time cost
- the amount of computation, given in number of iterations
- 6 is the default
m_cost - memory usage
- 16 is the default - this will produce a memory usage of 2 ^ 16 KiB (64 MiB)
parallelism - number of parallel threads
- 1 is the default
If you are hashing passwords in your tests, it can be useful to add
the following to the config/test.exs
file:
config :argon2_elixir,
t_cost: 2,
m_cost: 12
NB. do not use these values in production.
Options
There are six options (t_cost, m_cost and parallelism can be used to override the values set in the config):
- t_cost - time cost
- m_cost - memory usage
- parallelism - number of parallel threads
format - output format
- this value can be
- :encoded - encoded with Argon2 crypt format
- :raw_hash - raw hash output in hexadecimal format
- :report - raw hash and encoded hash, together with the options used
- :encoded is the default
hashlen - length of the hash (in bytes)
- the default is 32
argon2_type - Argon2 type
- this value should be 0 (Argon2d), 1 (Argon2i) or 2 (Argon2id)
- the default is 1 (Argon2i)