K061 / Hashes, MACs and key derivation
Argon2
Argon2 is a memory-hard function used for password hashing and proof of work.
CRYPTOGRAPHY LAB / K061
Cryptography Lab · Argon2
Run real computations and inspect intermediate states step by step.
Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.
Argon2 RFC 9106 compression G only (two repeated-seed 1024-byte blocks; no password KDF)
See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.Output
Previous state
- Definition and overview
- Argon2 is a memory-hard function used for password hashing and proof of work. Source document ↗
- Classification and reversibility
- A password-hashing and key-derivation function, not encryption or encoding; it is not decrypted. Source document ↗
- Key or secret requirements
- Takes a password, salt, parameters and an optional secret key as input. Source document ↗
- Operating principle and structure
- Creates seed H0 with BLAKE2b, fills m KiB of memory with p lanes of 1 KiB blocks, iterates t times, then generates a tag with final XOR and hashing. Source document ↗
- Key size, block size and parameters
- Parameters including lane count, 1 KiB blocks, memory, time, parallelism and output length control the cost and output. Source document ↗
- Security strength and recommendation
- OWASP recommends strong, slow hashing such as Argon2id for password storage. Source document ↗
- Known attacks and vulnerabilities
- Argon2i is optimized for side-channel resistance, and Argon2id is a hybrid variant. Source document ↗
- Standards and certification
- A hash/KDF standardized in IETF RFC 9106 (2021). Source document ↗
- Typical uses
- Used for password hashing for credential storage, key derivation and other applications. Source document ↗
- Implementations, libraries and tools
- Implementations include node-argon2, argon2-cffi, RustCrypto and the reference C implementation. Source document ↗
- Decryption or decoding
- Instead of decrypting, recompute with the same function, salt and parameters and compare against the stored hash. Source document ↗
- Advantages
- Memory-hard design increases the cost of guessing and helps defend against trade-off attacks. Source document ↗
- Limitations and cautions
- High memory requirements may cause swapping or latency in containers and low-resource environments, so parameters need tuning. Source document ↗
- Distinguishing encryption, encoding and hashing
- Argon2 is a hash/KDF rather than encryption or encoding, so there is no decryption; verification is recomputation and comparison. Source document ↗
Practical examples
Example
When a user submits a password, Argon2id creates a hash using the salt and parameters. Login is determined by comparing the recomputed result with the stored hash.
Procedure
Argon2: (1) generate a salt and select parameters; (2) create a hash with Argon2id; (3) store hash, salt and parameters; (4) recompute and compare using the same values during verification. Encryption and encoding are decrypted or decoded with separate keys/algorithms; those processes do not apply to Argon2.
Scenario
Store Argon2id hashes in the database when users register for a web service, and verify them at login. If key derivation is needed, use a KDF API appropriate for that purpose, not as a means of decrypting ciphertext.
Pitfalls and alternatives
Do not use fast hashes such as SHA-256 for password storage; use slow hashing such as Argon2id. Watch for swapping and latency caused by memory parameters in containers. In FIPS-validated environments, consider approved alternatives such as PBKDF2-HMAC-SHA-256.
References
- RFC 9106: Argon2 Memory-Hard Function for Password Hashing and Proof-of-Work Applications ↗
- Password Hashing - The RustCrypto Book ↗
- Argon2 (password hashing) · Encryption Codex ↗
- Optimized Implementation of Argon2 Utilizing the Graphics Processing Unit ↗
- Password Storage - OWASP Cheat Sheet Series ↗
- Argon2 ↗
- What is Argon2? ¶ ↗
- The password hash Argon2, winner of PHC ↗
- ranisalt/node-argon2 ↗
- How to Hash a Password ¶ ↗