Pcornel
Browse topics
Options
Recent
Favorites
Security · Technical reference

Password Hashing

Direct answer

Password hashing stores passwords with a slow, salted algorithm — Argon2id, bcrypt, scrypt or PBKDF2 — so stolen hash databases are expensive to crack. Fast hashes like SHA-256 alone are unsuitable.

When to use this

Use this when storing user passwords safely.

First 30 seconds

1. Password hashing uses slow, salted, memory-hard KDFs.

2. Argon2id preferred; scrypt, bcrypt, PBKDF2 acceptable.

3. Tune cost to about 100–500 ms.

4. Rehash on login when upgrading.

5. Never fast hashes.

Operational verification

password + salt + cost → KDF → hash

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • One global salt (pepper) instead of a unique salt per user.
  • Truncating passwords before hashing.
  • Low work factors chosen years ago and never raised.
  • Rehashing the existing hash with a new algorithm without wrapping properly — plan a migration on next login.
Platform / version applicability
Cryptography, PKI and secrets
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformCryptography, PKI and secrets
Scope / prerequisiteUse this when storing user passwords safely.
What next?2 suggested next steps
Evidence1
On this pageJump to a specific section
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Use slow, salted algorithms.
  • Never plain or fast hashes.
  • Upgrade old hashes at login.
Key checks
  • grep <user> /etc/shadow | cut -d: -f2 | cut -c1-3 — algorithm prefix
  • App password storage (Argon2id/bcrypt/scrypt) — review
  • Cost parameters — tuned
ReferenceWhy it matters1 section · depth on demand

Requirements

  • Unique random salt per password (stops rainbow tables and identical-hash spotting).
  • Slow, tunable algorithm: Argon2id (first choice), scrypt, bcrypt, or PBKDF2 where FIPS is required.
  • Optional pepper (secret key stored outside the database).
  • Rehash with stronger parameters when users log in.

OWASP minimums (2024): Argon2id m=19 MiB, t=2, p=1; bcrypt cost 10+; PBKDF2-HMAC-SHA256 600 000 iterations. Never encrypt passwords reversibly, and never use plain SHA-256 or MD5.

ReferenceImportant terms & boundaries2 sections · depth on demand

Recommended parameters (OWASP)

AlgorithmMinimum setting
Argon2idm=19 MiB, t=2, p=1
scryptN=2¹⁷, r=8, p=1
bcryptcost 10+, 72-byte input limit
PBKDF2-HMAC-SHA256600,000 iterations

Use a unique salt per password (libraries do this) and re-hash on next login when parameters change.

In depth

Password hashing stores passwords as slow, salted, one-way hashes so that a stolen database does not reveal them and guessing each password is expensive. Fast general-purpose hashes are unsuitable because attackers can test billions of guesses per second on GPUs.

FunctionStatusNotes
Argon2idRecommendedMemory-hard; tune memory/time cost
scryptGoodMemory-hard
bcryptAcceptable72-byte input limit; cost 12+
PBKDF2Acceptable (FIPS)High iteration counts
yescryptGoodDefault on several Linux distributions
Unsalted/fast hashesInsecureMD5, SHA-1, SHA-256 alone

Use a maintained library (e.g. argon2-cffi, passlib, framework defaults), store algorithm parameters with each hash, and upgrade hashes transparently when users log in.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docCryptography, PKI and secrets current

Authoritative/upstream documentation reviewed for bounded claims in Hashing → Password Hashing. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://csrc.nist.gov/pubs/fips/180-4/upd1/final · confidence 94%
Confirmation

Confirm action

Continue?