Hash Generator · Tutorial
How to check a password breach list without revealing it
7 min readintermediateUpdated
Breach-checking services can tell you whether a password appears in known data leaks without you ever sending them the password. The trick uses SHA-1 and a technique called k-anonymity. This tutorial walks through how it works, step by step, using a deliberately bad sample password, so you understand what is and isn't shared.
What you need
- The Hash Generator
- A sample password to experiment with (the Try it button loads
P@ssw0rd, a well-known weak one)
Steps
Hash the password
Type a test password into the box. The tool calculates its SHA-1 locally. For
P@ssw0rd, it's21bd12dc183f740ee76f27b78eb39c8ad972a757. Tick Uppercase, because breach databases usually list hashes in capitals.21BD12DC183F740EE76F27B78EB39C8AD972A757Split off the first five characters
The hash is split into a 5-character prefix,
21BD1, and the remaining 35 characters. Only the prefix is sent to the breach service.Understand what the service sees
There are only about a million possible 5-character prefixes, and each one matches hundreds of different leaked passwords. The service replies with every hash suffix that shares your prefix. It can't tell which one, if any, is yours. This is k-anonymity.
Compare locally
Your device then searches the returned list for the other 35 characters of your hash. If it finds them, the password has appeared in a breach, along with a count of how often.
P@ssw0rdhas been seen many thousands of times.Act on the result
Any password that shows up in a breach list is unsafe, however complex it looks, because attackers try leaked passwords first. Replace it, and use a unique random password or passphrase from the Password Generator.
Try it yourself
Opens the Hash Generator with this tutorial's sample loaded.
Common mistakes
- Sending the full hash
- The full SHA-1 of a password is almost as sensitive as the password, since common passwords can be looked up. Proper breach-check tools only ever send the 5-character prefix.
- Thinking "not found" means strong
- A password missing from breach lists can still be weak or easy to guess. Use the Password Strength Checker as well.
- Using SHA-1 to store passwords
- The breach-check format uses SHA-1 only for lookups. Applications must store passwords with slow, salted algorithms like bcrypt.
Next steps
Go back to the Hash Generator, or keep going with one of these:
FAQ
Does this page contact a breach service?
No. This tool only calculates the hash on your device. It explains the method, and you decide whether to use a breach-checking service.