0Pricing
Cyber Security Academy · Lesson

Password Hashing: bcrypt, Argon2, PBKDF2

Learn why plaintext storage is dangerous and how salted hashing protects passwords.

Password Hashing: bcrypt, Argon2, PBKDF2 is a free Cyber Security Academy lesson on CoddyKit — lesson 2 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 Cyber Security Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

Why Not Store Passwords in Plaintext?

Storing passwords in plaintext is catastrophic — a single database breach exposes every account. Passwords must be processed with a one-way function before storage so that even database access doesn't reveal the original password.

What is Hashing?

A hash function converts input of any length into a fixed-length output. The same input always produces the same output, but the original cannot be recovered from the hash. Examples: SHA-256, bcrypt, Argon2.

Why Not Use SHA-256 for Passwords?

General-purpose hash functions like SHA-256 are designed to be fast. An attacker can compute billions of SHA-256 hashes per second on a GPU, making brute-force cracking feasible.

Password hashing requires slow, expensive functions.

Salting

A salt is a random value added to each password before hashing. It ensures two users with the same password have different hashes, preventing rainbow table and batch cracking attacks. The salt is stored alongside the hash (it's not secret).

# Conceptual salt example
hash = bcrypt("password" + random_salt)

bcrypt

bcrypt was designed in 1999 specifically for password hashing. It has a configurable cost factor that controls how slow the hashing is. As hardware improves, increase the cost factor to maintain security.

Cost factor of 12 is common today — takes ~250ms to hash on a modern CPU.

PBKDF2

PBKDF2 (Password-Based Key Derivation Function 2) applies a hash function (e.g., HMAC-SHA256) many times (iterations). More iterations = slower = more secure. Recommended by NIST and used by WPA2 for Wi-Fi passwords.

Argon2

Argon2 won the Password Hashing Competition in 2015. It's the modern standard. It's configurable on:

  • Time cost — number of iterations
  • Memory cost — RAM required (limits GPU acceleration)
  • Parallelism — number of threads

Use Argon2id for most applications.

Rainbow Tables

A rainbow table is a precomputed lookup of hash → plaintext. Without salting, an attacker who has the hash can look it up in the table instantly. Salting renders rainbow tables useless because each hash is unique.

Password Cracking Techniques

Common offline cracking approaches:

  • Dictionary attack — try common passwords and variations
  • Brute force — try all character combinations
  • Rule-based — apply mutation rules to dictionary (append year, capitalize, leet speak)
  • Tools: Hashcat, John the Ripper

Choosing the Right Algorithm

Order of preference for new applications:

  1. Argon2id — best resistance to GPU/ASIC cracking
  2. bcrypt — widely supported, proven track record
  3. PBKDF2 — NIST-approved, required in some compliance contexts

Never use: MD5, SHA-1, or unsalted SHA-256 for passwords.

Verification Process

When a user logs in:

  1. Retrieve stored hash and salt for the user
  2. Hash the submitted password with the same salt and algorithm
  3. Compare resulting hash to stored hash (constant-time comparison)
  4. Never decrypt — comparison only

Quick Check: Password Hashing

Which password hashing algorithm is considered the current best practice and was the winner of the Password Hashing Competition?

Lesson Recap

Passwords must be stored as hashes, not plaintext. Fast algorithms like SHA-256 are unsuitable — use slow password hashing functions: Argon2id (preferred), bcrypt, or PBKDF2. Always use a random salt per password to prevent rainbow table attacks. Never roll your own cryptography — use proven libraries.

Frequently asked questions

Is the “Password Hashing: bcrypt, Argon2, PBKDF2” lesson free?

Yes — the full text of “Password Hashing: bcrypt, Argon2, PBKDF2” is free to read here on the web, and the Cyber Security 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 Cyber Security Academy course, upgrade to CoddyKit PRO.

What will I learn in “Password Hashing: bcrypt, Argon2, PBKDF2”?

Learn why plaintext storage is dangerous and how salted hashing protects passwords. You practise Cyber Security 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 Cyber Security Academy?

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

How long does the “Password Hashing: bcrypt, Argon2, PBKDF2” 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 Cyber Security Academy lesson?

Yes. Every Cyber Security 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. Password Strength and Policies
  2. Password Hashing: bcrypt, Argon2, PBKDF2
  3. Multi-Factor Authentication
  4. Credential Stuffing and Password Spraying
← Back to Cyber Security Academy