0Pricing
Cryptology Academy · Lesson

Argon2: Memory-Hard Password Hashing

Explore Argon2i, Argon2d, Argon2id and why memory-hardness matters.

Argon2: Memory-Hard Password Hashing is a free Cryptology Academy lesson on CoddyKit — lesson 3 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Cryptology Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Welcome

Argon2 won the Password Hashing Competition (PHC) in 2015 and is OWASP's top recommendation. Its memory-hard design defeats GPU and ASIC attacks that bcrypt cannot.

Why Memory-Hardness Matters

GPUs have thousands of cores but limited RAM per core (~1KB). Argon2 requires 64MB+ RAM per hash. Attackers trying 1000 parallel hashes need 64GB RAM — expensive and limited.

Argon2 Variants

Argon2d: data-dependent access — fastest but vulnerable to side-channel timing attacks. Argon2i: data-independent access — safe against timing attacks. Argon2id: hybrid — recommended for most applications.

Argon2 Parameters

m: memory in kilobytes (OWASP: 19456 KB = 19 MB minimum, 64 MB recommended) t: time cost / iterations (3 recommended) p: parallelism / threads (4 recommended) salt: 16 bytes random output: 32 bytes

Argon2id in Python

from argon2 import PasswordHasher ph = PasswordHasher( memory_cost=65536, # 64 MB time_cost=3, parallelism=4 ) hash = ph.hash('my_password') # Verify: ph.verify(hash, 'my_password') # True

Argon2 Hash Format

$argon2id$v=19$m=65536,t=3,p=4$ bmFuZG9tc2FsdHJhbmRvbQ$ KaE5Jjy7E8...hashed... All parameters are stored in the hash string. Verification is self-contained — no separate parameter storage needed.

OWASP Argon2id Recommendations 2024

Minimum: m=19456 KB (19 MB), t=2, p=1 Recommended: m=65536 KB (64 MB), t=3, p=4 High security: m=262144 KB (256 MB), t=4, p=8 Adjust based on your server's available memory.

Argon2 vs bcrypt vs PBKDF2

Argon2id: memory-hard, ASIC-resistant, recommended for new systems. bcrypt: widely supported, not memory-hard, good legacy support. PBKDF2: FIPS compliant, not memory-hard, use for regulated environments.

Hash Upgrade Strategy

When upgrading from bcrypt to Argon2: 1. Add new column for new hash 2. On next login: verify with old bcrypt, re-hash with Argon2, store new hash 3. After X months, force password reset for users not yet upgraded

Argon2 in Real Frameworks

Django: set PASSWORD_HASHERS=['django.contrib.auth.hashers.Argon2PasswordHasher'] Node.js: use argon2 package (not argon2-ffi) PHP 7.2+: built-in PASSWORD_ARGON2ID constant in password_hash()

Pepper: Server-Side Secret

A pepper is a server-side secret mixed with the password before hashing: hash(password + pepper). Even if the DB is leaked, attacker needs the pepper too. Rotate pepper = invalidate all hashes.

Quick Check

Why is Argon2 more resistant to GPU attacks than bcrypt?

Recap

Argon2id is the best tool for password hashing today. Next we compare all three algorithms and learn to choose the right one for your context.

Frequently asked questions

Is the “Argon2: Memory-Hard Password Hashing” lesson free?

Yes — the full text of “Argon2: Memory-Hard Password Hashing” is free to read here on the web, and the Cryptology Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Cryptology Academy course, upgrade to CoddyKit PRO.

What will I learn in “Argon2: Memory-Hard Password Hashing”?

Explore Argon2i, Argon2d, Argon2id and why memory-hardness matters. You practise Cryptology Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Cryptology Academy?

No prior experience is required. Cryptology Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 3 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Argon2: Memory-Hard Password Hashing” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Cryptology Academy lesson?

Yes. Every Cryptology Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Why Plain SHA-256 Fails for Passwords
  2. bcrypt: Algorithm & Cost Factor
  3. Argon2: Memory-Hard Password Hashing
  4. PBKDF2 & Choosing the Right Algorithm
← Back to Cryptology Academy