Skip to content
CoreSource checked

Argon2

Hashes passwords with tunable memory and time cost.

Quick Facts

Compact metadata for implementation and discovery.

Category
Cryptography
Difficulty
Intermediate
Family
Password Hashing
Tier
Core
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
4
Code example
Not ready
Visualization
Ready
Aliases
Argon2id

Overview

Argon2 derives password hashes through memory-hard computation, making large-scale guessing more expensive.

Core Concepts

security primitivememory-hard hashingsecurity assumptionpassword hashingkey materialmessage transformationmisuse resistanceparameter validation

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(mt)

Average

O(mt)

Worst

O(mt)

Space

O(m)

When to Use

  • Use Argon2 when you need to fill memory with password-dependent data.
  • Use it for password storage with inputs like password.
  • Use it only through reviewed libraries when the security goal matches the primitive.
  • Use it when the Password Hashing tradeoff is acceptable for the problem size.

When Not to Use

  • Avoid custom implementations for production security or when key, nonce, and padding rules are unclear.
  • Avoid it when the required output is not password hash.

What It Does

  • Fills memory with password-dependent data
  • Mixes memory blocks over repeated passes

Use Cases

  • Password storage
  • Key derivation
  • Credential hardening

Inputs

  • Password
  • Salt
  • Memory and time parameters

Outputs

  • Password hash

Key Formulas (1)

Memory block update

block[i] = G(block[i − 1], block[referenceindex])
block[i] = G(block[i - 1], block[reference_index])

Fills memory with password-dependent blocks that depend on earlier and referenced blocks.

Pseudocode

  1. 1.Combine password and salt
  2. 2.Initialize memory blocks
  3. 3.Mix blocks for configured passes
  4. 4.Compress final memory state
  5. 5.Return the derived hash

Canonical Example

Input
message = 'pay 10' with configured keys, nonces, or public parameters
Output
ciphertext, tag, digest, signature, proof, or verification result
Explanation
The primitive applies its defined arithmetic, hashing, or block operation without inventing extra protocol steps.

Implementation Notes

  • Keep the input contract explicit: Password; Salt; Memory and time parameters.
  • Validate parameters, key sizes, nonces, salts, and error handling against the library's recommended API.
  • Use reviewed libraries and protocol specifications for production security-sensitive code.

Common Pitfalls

  • Argon2id is commonly recommended for password hashing.
  • Confusing encryption, hashing, signatures, and authentication codes as interchangeable tools.
  • Handle empty, invalid, and boundary inputs before trusting password hash.
  • Treating educational pseudocode as production crypto can hide nonce, parameter, and side-channel requirements.

Interactive Mechanism Walkthrough

Graph Frontier & Edge Relaxation

Show memory blocks being filled and repeatedly mixed.

Argon2 mechanism walkthrough step 1 of 5suvwxt
Step 1 of 5: Combine password and salt
memory-hard-hash

Notes

Argon2 operates in O(mt) time and O(m) space within the Password Hashing family. Key governing relation: block[i] = G(block[i - 1], block[reference_index]). Often compared with HMAC and SHA-256.

Sources (1)

What each reference supports for this entry.

RFC 9106

Documentation

IETF/CFRG implementer-oriented reference for Argon2 password hashing.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Alternative toPBKDF2

Argon2 is designed to resist hardware attacks better than simple iterated KDFs.

Alternative toScrypt

Argon2 and scrypt are memory-hard password hashing schemes.

Related Algorithms

Tags

CryptographyPassword HashingSecurity