SSOGEN / Learn / Argon2 Hash: One Stored String, Decoded Field by Field
Learn
Argon2 Hash: One Stored String, Decoded Field by Field
Each Argon2 hash string carries everything a verifier needs: variant, version, memory, passes, lanes, salt and tag. OWASP's minimum for Argon2id is 19 MiB of memory, 2 passes and 1 lane.

OWASP’s Password Storage Cheat Sheet puts Argon2id first for storing passwords. The string below is a real Argon2id hash, made for this page on November 18, 2026 from the example password correct horse battery staple. Read left to right, any stored value can be checked against OWASP and RFC 9106.
One Argon2id hash, field by field
Seven fields, split by $ and commas. Three of them, m, t and p, set what every guess costs.
$argon2id$v=19$m=19456,t=2,p=1$/3LTAx7wByKuhZDKTXN+UQ$NjfbTX0S7uD74akPRg3lQHYs9rsadXZZtmmKUcT8C38- Identifier
argon2id- The variant. The verifier picks the algorithm from this field:
argon2d,argon2iorargon2id. - Version
v=19- 19 is 0x13, the only version byte RFC 9106 allows. PHC strings also accept 16, an earlier version.
- Memory
m=19456- 19,456 KiB, or 19 MiB, filled for every hash. The attacker pays it for each guess, and your server pays it for each sign-in.
- Passes
t=2- Two passes over that memory. RFC 9106 uses t to tune running time without changing memory.
- Lanes
p=1- The memory is split into one lane. PHC allows 1 to 255.
- Salt
/3LTAx7wByKuhZDKTXN+UQ- 16 random bytes in 22 characters. The encoding is standard Base64 with the
=padding removed, so/and+appear. PHC allows 8 to 48 bytes. - Hash
NjfbTX0S7uD74akPRg3lQHYs9rsadXZZtmmKUcT8C38- The 32-byte tag in 43 characters. At sign-in the verifier recomputes it from the password and the fields to its left, then compares.
Two optional parameters may follow p: keyid names a secret key in up to 8 bytes, and data adds up to 32 bytes of associated data. The PHC string format fixes the order: m, t, p, keyid, data.
The tag comes from OpenSSL 3.5.8 and a salt from openssl rand -hex 16. Node.js 24.19.0 crypto.argon2Sync returned the same 32 bytes.
$ openssl kdf -keylen 32 -kdfopt "pass:correct horse battery staple" \ -kdfopt hexsalt:ff72d3031ef00722ae8590ca4d737e51 \ -kdfopt iter:2 -kdfopt memcost:19456 -kdfopt lanes:1 ARGON2ID36:37:DB:4D:7D:12:EE:E0:FB:E1:A9:0F:46:0D:E5:40:76:2C:F6:BB:1A:75:76:59:B6:69:8A:51:C4:FC:0B:7FWhat do m, t and p mean in an Argon2 hash?
m is the memory each hash fills, in KiB; t is the number of passes over it; p is the number of lanes it is split into. Argon2 is memory-hard, so every guess in progress holds its own m KiB.
| When | Then |
|---|---|
| You raise m | Each guess holds more memory. At m=19456, 1 GiB fits 53 hashes at once (1,048,576 KiB divided by 19,456 KiB). |
| 100 sign-ins hash at the same moment | Hashing alone needs 100 × 19 MiB, about 1.9 GiB. Plan for peaks. |
| You raise t | Each hash makes more passes over the same memory, so only time goes up. |
| You raise p | The same memory is split into more lanes. OWASP notes that this does not multiply the memory or act as an iteration count. |
These figures are arithmetic from m, not measurements. OWASP warns that a work factor set too high lets an attacker exhaust the server with login attempts, and says one hash should take less than a second. Measured times for the OWASP settings on one JVM core are in password hashing in Java.
OWASP and RFC 9106 settings, side by side
OWASP lists five settings with equal defense, trading CPU for RAM. RFC 9106 asks for far more memory.
| Source | m (KiB) | t | p | Note |
|---|---|---|---|---|
| OWASP | 47104 (46 MiB) | 1 | 1 | Do not use with Argon2i |
| OWASP | 19456 (19 MiB) | 2 | 1 | The minimum in OWASP’s summary; do not use with Argon2i |
| OWASP | 12288 (12 MiB) | 3 | 1 | |
| OWASP | 9216 (9 MiB) | 4 | 1 | |
| OWASP | 7168 (7 MiB) | 5 | 1 | |
| RFC 9106, FIRST RECOMMENDED | 2097152 (2 GiB) | 1 | 4 | Default for all environments; 128-bit salt, 256-bit tag |
| RFC 9106, SECOND RECOMMENDED | 65536 (64 MiB) | 3 | 4 | For memory-constrained environments; 128-bit salt, 256-bit tag |
The libraries follow the RFC. argon2-cffi 25.1.0 takes its defaults from the SECOND RECOMMENDED profile, and node-argon2 0.45.2 hashed with m=65536,t=3,p=4 in our run.
Argon2id for passwords, Argon2d for proof of work
RFC 9106 names Argon2id the primary variant.
- Argon2id: MUST be supported. Memory access is data-independent for the first half of the first pass, data-dependent after that. Built for password hashing: side-channel protection plus brute-force cost.
- Argon2i: MAY be supported. Memory access is data-independent throughout. Built for password hashing and password-based key derivation; it makes more passes to resist trade-off attacks.
- Argon2d: MAY be supported. Memory access is data-dependent. Built for cryptocurrencies and proof of work, where side-channel timing attacks are no threat.
If side-channel attacks are possible or you are unsure, RFC 9106 says to choose Argon2id.
Argon2 vs bcrypt, scrypt and PBKDF2
OWASP ranks the four by situation. Only Argon2id and scrypt make each guess cost memory as well as time.
| Algorithm | What a guess costs | OWASP minimum | When OWASP uses it |
|---|---|---|---|
Argon2id |
Memory and time |
m=19456, t=2, p=1 |
First choice |
scrypt |
Memory and time |
N=2^17 (128 MiB), r=8, p=1 |
When Argon2id is not available |
bcrypt |
Time; most implementations stop reading at 72 bytes |
Work factor 10 |
Legacy systems only |
PBKDF2 |
Time, through iterations |
600,000 rounds of HMAC-SHA-256, or 220,000 of HMAC-SHA-512 |
When FIPS-140 compliance is required |
PBKDF2 with HMAC-SHA-1 at 1,400,000 iterations stays on OWASP’s list for legacy systems only. The rules a service sets for the passwords it accepts are in NIST password guidelines.
Python and Node.js: verify a stored hash
Neither call takes m, t or p. The library reads them from the string, so hashes with old and new settings verify side by side.
from argon2 import PasswordHasherfrom argon2.exceptions import VerifyMismatchError
ph = PasswordHasher() # defaults: m=65536, t=3, p=4try: ph.verify(stored, password) # True, or raises if ph.check_needs_rehash(stored): # True for m=19456 stored = ph.hash(password) # save the new stringexcept VerifyMismatchError: pass # wrong passwordimport argon2 from 'argon2';
if (await argon2.verify(stored, password)) { // true or false if (argon2.needsRehash(stored)) { // true for m=19456 stored = await argon2.hash(password); // save the new string }}We ran both against the example string on November 18, 2026, with Python 3.9.25 and Node.js 24.19.0. The right password verified. The guess wrong guess raised VerifyMismatchError in Python and returned false in Node.js. Both libraries asked for a rehash, because their defaults are above m=19456.
Argon2, bcrypt and SHA-256 questions
What is Argon2 for?
Argon2 turns a password into a hash that costs memory and time to compute, for password storage and password-based key derivation. It won the Password Hashing Competition in 2015. RFC 9106 requires every implementation to support Argon2id, the variant OWASP recommends for passwords.
What hash function does bcrypt use?
None: bcrypt is built on the Blowfish block cipher, not on a hash function such as SHA-2. Provos and Mazières (USENIX 1999) gave Blowfish an expensive key schedule and called it eksblowfish. bcrypt runs that key schedule with the password and a 128-bit salt, then encrypts the text OrpheanBeholderScryDoubt 64 times.
Why not hash passwords with SHA-256?
SHA-256 is built to be fast, and fast is wrong for passwords. It is a general-purpose hashing algorithm from the SHA-2 family with no work factor, so an attacker with a stolen hash can test guesses at full hardware speed. OWASP says password hashes should be slow, unlike MD5 and SHA-1, which were designed to be fast.
A strong hash still needs a strong password
Argon2id makes every guess expensive. A common password is still among the first guesses an attacker tries. Measure a candidate with the password entropy calculator, and set length and blocklist rules from password policy.
Sources, all read 2026-11-18:
- OWASP Password Storage Cheat Sheet (repository file last changed 2026-10-30)
- RFC 9106, Argon2 Memory-Hard Function for Password Hashing and Proof-of-Work Applications, sections 1, 3.1 and 4 (Informational, September 2021)
- C2SP PHC string format, Argon2 encoding
- argon2-cffi API reference and profiles source, version 25.1.0 on PyPI
- node-argon2 README, version 0.45.2 on npm
- Provos and Mazières, A Future-Adaptable Password Scheme, USENIX 1999
Updated