The Attack Model Decides the Defence
Different scenarios demand completely different defences, so identify the adversary before discussing strength:
| Scenario | What the attacker can do | Effective defence |
|---|---|---|
| Credential stuffing | Replay username/password pairs leaked from other sites | A unique password per site plus breach screening |
| Online brute force | Guess directly against the login endpoint | Rate limits, progressive delays, lockout policy |
| Offline cracking | Holds the database hashes and grinds locally | Slow hashing (Argon2id / bcrypt) with a per-user salt |
| Phishing | Lure you into typing credentials on a fake site | Passkeys / WebAuthn |
| SIM swap | Take over your phone number | Do not use SMS as a second factor |
The most common entry point is not cracking but credential stuffing — reusing one password across sites. That is why "an independent random password per site" beats "one very strong universal password": the former removes the attack chain, the latter hardens a single point.
Entropy: The Formula, Its Failures, and a Better Estimate
The Ideal Formula
E = log₂(R^L), where R is the charset size and L the length. Plugging it in: eight digits give about 26.6 bit, eight alphanumeric characters about 47.6 bit, and twelve alphanumeric about 71.5 bit (runnable code at the end). The floor for random generation is 12 characters and 70 bit or more — a figure that does not apply to human-chosen passwords.
Where the Formula Breaks: Humans Are Not a Random Source
The formula assumes every character is independently and uniformly random. Humans are not, so real entropy falls far below the nominal figure:
| Password | Nominal entropy (95-char set) | Realistic crackability |
|---|---|---|
P@ssw0rd1 |
~52 bit | Dictionary plus common substitutions; hit within tens of thousands of tries |
Qwerty123! |
~52 bit | Keyboard sequence plus digit suffix; extremely fast |
Zhang1985! |
~52 bit | Common surname plus birth year; a targeted dictionary breaks it instantly |
Tr0ub4dor&3 |
~65 bit | Still a "word + substitutions + suffix" structure |
Length matters far more than character variety. Twelve random lowercase letters (about 56 bit) beat eight characters across four classes (nominally 52.6 bit, realistically under 30). "Must contain upper, lower, digits, and symbols" only pushes users toward predictable substitutions.
zxcvbn: Recognise Patterns First, Then Estimate Guesses
Modern strength estimators (zxcvbn and its derivatives) do not count charsets. They recognise patterns and estimate the guess count:
- dictionary words, including common names, places, brands, and fictional characters;
- common substitutions (
a→@,o→0,i→1); - keyboard sequences (
qwerty,1qaz2wsx); - repeats, runs, and dates (
aaaa,12345,1985); - structural splits (
word+123+!graded separately, then combined).
This also explains why correct-horse-battery-staple is strong: four random common words give a space equal to the wordlist size to the fourth power. Strength is the number of guesses those patterns require, not the number of character classes.
Three Old Rules NIST 800-63B Reversed
Many policies still follow NIST's 2003 Appendix A. SP 800-63B reversed it:
| Old rule | Current stance | Why |
|---|---|---|
| Force a change every 90 days | ❌ Not recommended | Users make predictable edits (password1→password2) and security drops |
| Require upper + lower + digit + symbol | ❌ Not recommended | Pushes users toward patterns like P@ssw0rd1 |
| Security questions | ❌ Remove | Answers are usually public, such as a surname or school |
| Minimum length ≥ 8 | ✅ Keep (12+ preferred) | Length is the only reliably effective complexity source |
| Screen breached passwords | ✅ Strongly recommended | Cuts off credential stuffing's ammunition |
| Allow pasting | ✅ Recommended | Blocking paste blocks password managers |
The correct trigger for a password change is evidence: account anomalies, the password appearing in a breach corpus, or a security incident — not a calendar.
Breach Screening: k-Anonymity Without Sending Plaintext
"Check whether this password is in a breach corpus" sounds like it requires uploading the plaintext. It does not. HIBP's Range API uses k-anonymity:
- The client hashes the password with SHA-1, only for the query, never for storage;
- It sends only the first five characters of that hash;
- The server returns every suffix matching that prefix, usually a few hundred;
- The client compares locally to see whether the full hash appears.
The server never sees the password or even the complete hash. Screening must end in an action: reject at signup and ask for another password, and reject at password change. A warning with no enforcement is the same as not screening.
MFA and Passkeys, Ordered by Phishing Resistance
| Factor | Phishing-resistant | SIM-swap resistant | UX | Verdict |
|---|---|---|---|---|
| Passkeys / WebAuthn | ✅ Strong | ✅ | Best: one biometric tap | First choice |
| Hardware security key | ✅ Strong | ✅ | Good, but must be carried | High-privilege accounts |
| TOTP app | ❌ Relayable in real time | ✅ | Medium: type six digits | Solid runner-up |
| SMS | ❌ | ❌ | Good | Fallback only |
| Email code | ❌ | ✅ | Medium | As strong as the mailbox |
Why passkeys resist phishing by construction: the private key is bound to a specific domain, and the browser or OS only signs for a matching domain. A fake site can copy the interface pixel for pixel, but it cannot obtain a signature valid on the real domain. TOTP cannot do this: the user types six digits into the fake site and the attacker relays them immediately.
The main threat to SMS is not interception but SIM swap: an attacker uses fabricated identity to port the number, and every code lands on their phone — often unnoticed.
Server-Side Checklist
Storage: One Decision Matters
Use a KDF. Not reversible encryption, not a bare hash. Whether that is Argon2id (preferred) or bcrypt at cost ≥ 12, how to derive parameters, and how to migrate legacy hashes are all in the password hashing guide. Two things matter here:
- a unique random salt per user, generated by the library — never hand-build
salt + SHA; keep the algorithm and parameter identifiers so you can upgrade at the next login; - never store plaintext, and never switch to reversible encryption "for later display" — a leaked key leaks everything.
The Login Endpoint
- Rate-limit by account: IP limits punish legitimate users behind NAT.
- Escalate delays after failures. A 15-minute lock beats a permanent one, which is itself a denial-of-service hole.
- Never distinguish "no such user" from "wrong password" in failure messages; that is an account-enumeration API.
- Reset tokens: single-use, ≤ 30 minutes, burned on use; generate them with the token generator.
Transport and Logging
- HTTPS everywhere; redirect the login page from HTTP with a 301.
- Never log passwords, full tokens, or reset links.
- Never put tokens in a URL query: they land in browser history, Referer headers, and proxy logs.
Monitoring
- Watch for new devices, unusual locations, and bursts of failures.
- Force a reset on any breach-screening hit.
Personal Checklist
- Use an independent random password for every important site, via a manager rather than memory.
- Make the master password a 4–6 word passphrase and enable MFA on it.
- Enable passkeys on your email and password manager first — if either falls, every other account can be reset through it.
- Choose passkeys over SMS wherever offered, and run key accounts through breach detection periodically.
Reproducible: Entropy Only Holds for Random Generation
import math
def entropy(length, pool): return length * math.log2(pool)
print(f"8 lowercase: {entropy(8, 26):.1f} bits") # -> 37.6
print(f"8 alnum: {entropy(8, 62):.1f} bits") # -> 47.6
print(f"12 alnum: {entropy(12, 62):.1f} bits") # -> 71.5
print(f"16 alnum: {entropy(16, 62):.1f} bits") # -> 95.3
The formula holds only for random generation: a human-chosen 8-character mixed password is nominally 47.6 bit and often below 30. Measure with the password strength analyser instead.