Use this when storing passwords with the recommended modern algorithm.
Argon2
Argon2 (Argon2id) is the recommended modern password hashing algorithm. It is memory-hard and configurable in memory, time and parallelism, making GPU and ASIC cracking expensive.
1. Argon2id: winner of the Password Hashing Competition, memory-hard.
2. Recommended default.
3. OWASP: e.g. m=19 MiB, t=2, p=1 minimum.
4. Encode parameters in hash string.
5. Rehash when increasing parameters.
password + salt + m,t,p → Argon2id
Context & applicabilityCommon mistakes · platform/version boundaries
- Using Argon2i or Argon2d instead of Argon2id for passwords.
- Memory set so high that many simultaneous logins exhaust the server.
- Not storing the parameters, making later verification impossible.
- Tuning by guesswork — measure: aim for ~100–500 ms per hash on your hardware.
Operational reference
Fast context before you go deeper.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Argon2id is memory-hard.
- Tune memory, time and parallelism.
- Use a unique salt per password.
python3 -c "from argon2 import PasswordHasher;print(PasswordHasher().hash('pw'))"— Argon2id hash- Parameters: memory, iterations, parallelism — OWASP minimums
argon2 <salt> -id -m 16 -t 3 -p 1 <<< pw— CLI test
ReferenceWhy it matters1 section · depth on demand
Variants and parameters
| Variant | Use |
|---|---|
| Argon2id | Password hashing (recommended) |
| Argon2i | Side-channel resistant, used for key derivation |
| Argon2d | Fastest, GPU resistant but leaks via side channels |
Tune memory first (e.g. 64 MiB), then iterations until a hash takes 0.1–0.5 s on your server; parallelism to the number of cores you can spare. The encoded string $argon2id$v=19$m=65536,t=3,p=4$... stores all parameters.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Argon2 won the Password Hashing Competition in 2015 and is the recommended password hashing algorithm. Argon2id — a hybrid of the data-dependent Argon2d and data-independent Argon2i — resists both GPU cracking and side-channel attacks.
Parameters (OWASP recommendations, choose one):
| Memory | Iterations | Parallelism |
|---|---|---|
| 19 MiB | 2 | 1 |
| 46 MiB | 1 | 1 |
from argon2 import PasswordHasher
ph = PasswordHasher(memory_cost=19456, time_cost=2, parallelism=1)
h = ph.hash(password)
ph.verify(h, password)
if ph.check_needs_rehash(h): h = ph.hash(password)
Increase memory cost as far as your servers allow under peak login load; memory hardness is what makes large-scale guessing expensive.
Example
argon2 "somesalt" -id -t 2 -m 16 -p 1 <<< "password" # m=2^16 KiB = 64 MiB
Documented example, not captured output. In code use libraries such as argon2-cffi (Python) or PHP password_hash($p, PASSWORD_ARGON2ID). Store the full encoded string ($argon2id$v=19$m=...,t=...,p=...$salt$hash), which includes the parameters.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Hashing → Argon2. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://csrc.nist.gov/pubs/fips/180-4/upd1/final · confidence 94%