Homeglossary

Argon2

Argon2 is a password-hashing algorithm that securely transforms a password into a one-way value for storage and verification. It is designed to make large-scale password guessing expensive by using both memory and processing time. For most new password-based systems, Argon2id is the recommended variant because it balances resistance to common attack methods.

Build safer login systems with Emergent.

What Is Argon2?

Argon2 is a password-hashing algorithm that turns a password into a one-way value for safe storage and later verification. It uses memory as well as processing time, making large-scale password guessing more costly. It won the Password Hashing Competition in 2015 and is specified in RFC 9106. Hashing differs from encryption because an application verifies a password without decrypting the stored value.

How Argon2 Password Hashing Works

A login system stores a verifier, not the original password.

  1. The application receives the password over a protected connection.
  2. It creates a unique random salt for that password.
  3. Argon2 runs using chosen memory, time, and parallelism settings.
  4. The app stores the encoded hash, salt, version, and settings.
  5. On login, it reruns verification rather than decrypting a password.

Argon2id vs Argon2i vs Argon2d

Argon2id is generally the preferred choice for new password storage.

VariantMemory accessBest use
Argon2idHybrid approachPassword hashing, with balanced attack resistance
Argon2iData-independentCases needing stronger side-channel resistance
Argon2dData-dependentSpecialized uses, not typical web logins

Why Argon2 Is Used for Password Storage

Its design gives developers useful defenses against offline password cracking.

  • Memory-hard work makes highly parallel cracking hardware less efficient.
  • Unique salts prevent one precomputed hash list from serving every account.
  • Cost settings can increase as infrastructure improves.
  • Encoded parameters support gradual rehashing after a successful login.
  • It suits consumer logins, administrator accounts, and password-derived keys.

Practical Limits of Argon2

Strong hashing is only one part of authentication security.

  • Higher memory settings consume server resources and add login delay.
  • Unbounded concurrent hashing can create denial-of-service risk.
  • It cannot make weak passwords strong before a breach.
  • It does not replace MFA, rate limiting, TLS, or secure sessions.

Argon2 vs bcrypt, PBKDF2, and SHA-256

Argon2id is usually better for new password storage because it is deliberately memory-hard.

OptionMemory-hardUse for new passwords
Argon2idYesPreferred
bcryptNoAcceptable legacy choice
PBKDF2NoOften retained for compatibility
SHA-256NoNot suitable alone

Safe Argon2 Implementation Practices

Use established libraries and test settings under realistic load.

  • Choose Argon2id and library-generated unique salts.
  • Benchmark memory and time costs on production-like systems.
  • Cap concurrent hash operations.
  • Store versioned encoded hashes and rehash after successful login when settings change.
  • Never create a custom cryptographic implementation.

Using Argon2 in Apps Built With Emergent

Teams using an AI web app builder should state credential security requirements early, including a maintained Argon2 library, protected secrets, and login tests. Argon2 belongs in the wider process of app design and development for any authenticated web or mobile product. Build safer login systems with Emergent.

Start Building
on Emergent today
Start Building