Pcornel
Security · Hashing

PBKDF2

Cheat sheet · https://pcornel.dk/topic.php?topic=4714

Back to the Topic

Answer

PBKDF2 derives keys or password hashes by running HMAC many times with a salt. It is standardized and FIPS-approved, but less resistant to GPU cracking than bcrypt, scrypt or Argon2, so use high iteration counts.

Remember

  • Uses HMAC with many iterations.
  • Less GPU-resistant than Argon2.
  • Use high iteration counts.

First checks

  • python3 -c "import hashlib;print(hashlib.pbkdf2_hmac('sha256',b'pw',b'salt'*4,600000).hex())" — PBKDF2 example
  • Iteration count (OWASP: ≥ 600,000 for SHA-256) — cost
  • Salt length — ≥ 16 bytes

Verify in this order

password + salt + iterations → PBKDF2 → key

Where it usually breaks

First mismatch in key/secret generation → storage/rotation → trust/certificate validation → protocol negotiation → cryptographic operation → peer/application verification; preserve identity/policy/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4714

Confirmation

Confirm action

Continue?