Work / Security education case study
Password Validator: show the crack, keep the password.
A real-time password auditor that explains how an attacker would break a password and checks it against hundreds of millions of breached passwords, without the password ever leaving the browser.
- Status
- Live
- Type
- Educational demonstration
- Disciplines
- Security education · immediate feedback · human-centered security
- Built
- 2026, solo · MIT licence
How to read the evidence labels
- Implemented
- In the code. Not necessarily tested.
- Author-tested
- Tested by me, with the method described. Not independent.
- Documented
- Described in project docs; not re-verified for this page.
- Design intent
- What the design aims to do. Effect not yet measured.
- Proposed
- Planned, not built.
- Gap
- Known missing or incomplete.
The problem
People are told to use strong passwords and are shown a red, amber or green bar. That bar never says why. A password like Summer2024! meets most corporate rules and still falls in seconds, and nobody learns that from a coloured bar.
There is also a trust problem: a tool that asks you to type a real password has to prove it is not collecting it.
The teaching moment
- Immediate, specific feedback. The score updates as you type, with an estimated crack time and the guess count behind it. Implemented
- Show the attacker's view. The password is broken down into the patterns a cracking tool would try first: dictionary words, names, dates, keyboard runs and common substitutions. Implemented
- Old rules versus current guidance. A side-by-side check against a legacy corporate policy and NIST SP 800-63B shows why length beats complexity. Implemented
- A better alternative, right there. A generator for random passwords and passphrases built from the EFF word list. Implemented
- Explain the score. A plain-language explainer shows how the 0 to 100 score is built: length, character variety, breach status and crack time. Any password that is breached or cracks in under an hour is rated weak, whatever else it has. Implemented
- Feedback changes behavior. Seeing the specific weakness should make better choices stick better than a rule list. Design intent
Checking breaches without sending the password
The page hashes the password with SHA-1 and sends only the first five characters of the hash to the Have I Been Pwned range API. The API returns every breached hash that starts with those five characters, hundreds at a time, and the page looks for a match itself. The service never learns the password or even its full hash. If the check cannot be reached, the page says so and offers a retry instead of guessing. Implemented
Privacy and security controls
| Control | Status | What it does |
|---|---|---|
| k-anonymity breach check | Implemented | Only the first five characters of the password's SHA-1 hash are sent to Have I Been Pwned. The match happens on the page. |
| Padded, anonymous request | Implemented | The breach request asks for padded responses and sends no cookies, no referrer and no cache entry. |
| Analysis in a worker | Implemented | Strength analysis runs in a background worker inside the page. No password is sent to any server for scoring. |
| Nothing stored | Implemented | No accounts, no logging, no analytics. The only stored value is the light or dark theme choice. |
| Auto-clear | Author-tested | The field clears itself after two minutes of inactivity, and a copied generated password is wiped from the clipboard after 30 seconds. |
| Strict security headers | Implemented | A content security policy that only allows connections to the site and the breach API, plus HSTS and protection against framing. |
| Unbiased generator | Implemented | Generated passwords and passphrases use the browser's cryptographic random source with rejection sampling, so no characters are more likely than others. |
| Password-manager friendly | Implemented | The field tells browsers and password managers not to save what is typed, and Esc clears it. |
Data handling
| Data | Where it goes | How long it is kept |
|---|---|---|
| The password you type | Analysed inside your browser tab | Never sent, never stored; cleared after inactivity |
| First 5 characters of its SHA-1 hash | Have I Been Pwned range API | Under HIBP's policies; the full hash and the password never leave the page |
| Theme choice | Your browser's local storage | On your device until you clear it |
| Share card image | Created in your browser; shows the score, never the password | Only if you save it |
How it evolved
The first version, from February to May 2026, was a Python command-line tool with a Streamlit web app. It checked passwords against a large local list of leaked passwords. In April 2026 I replaced the local list with the Have I Been Pwned range API: broader coverage and nothing large to ship or store.
In May 2026 I rebuilt it as a browser-only React app that carries the same scoring rules, so no server of mine ever handles a password. The September 2026 release hardened the security headers, self-hosted the fonts, added the idle and clipboard auto-clear, and improved accessibility.
Testing and accessibility
22 tests across 7 files
Vitest and Testing Library: the password input, idle auto-clear, live validation timing, the generator, the breach client and the interface states.
axe-core under the production security policy
A script runs axe-core in a real browser against dark and light themes at desktop and phone widths, and fails on serious or critical issues. Run before releases.
Scores and breach results are announced to screen readers, motion respects the reduced-motion setting, and the light theme's colours were adjusted for WCAG AA contrast. Implemented
Stack
- React
- Vite
- zxcvbn (in a Web Worker)
- Have I Been Pwned range API
- Web Crypto
- Vitest
- Playwright + axe-core
- Cloudflare Pages