“Check your password against breach databases” sounds like a trap: to find out whether a password is in a database, you would seem to have to send it there. The technique that avoids this was worked out long ago, and it is elegant enough to be worth walking through in full.
Three steps
-
The password is hashed on your side
In the browser, with no network request at all. A hash is a forty-character string from which the password cannot be recovered.
-
Only the first five characters go to the server
Not the whole hash, just its beginning. That is far too little to identify a password: tens of thousands of different hashes share any given prefix.
-
The server returns every matching hash
All the hashes in its database starting with those five characters. The comparison then happens in your browser, among the ones sent back.
It sees a request for five characters and hands back the whole list under them. Which of the thirty thousand is yours — or whether any of them is — it never finds out: the comparison happens after the reply, on your side.
What the server does see
| What | Visible? |
|---|---|
| Your password | No |
| The full hash of your password | No |
| The first five characters of the hash | Yes — but that covers thousands of passwords |
| Your IP address and the time of the request | Yes — as with any request |
| Whether the password was found | No — the comparison happens on your side |
| How many times you checked | Yes — from the number of requests |
What to do with the result
A password that is found means one thing: it exists in public databases and is being tried automatically across hundreds of sites. It does not matter how it got there or how complex it looked.
- Change it everywhere it was used, not only where you happen to remember.
- Start with email — everything else is recovered through it.
- Do not try to “patch” the password by adding a character: variations are generated automatically.
A password that is not found does not mean it is strong. The databases are incomplete and a fresh breach takes time to reach them — this is a check for known compromise, not a certificate of strength. What actually makes a password strong is covered in entropy.