← Blog

How the k-Anonymity Model Works and Why It Protects Your Privacy

Privacy · · 6 min read

When you use our leaked password checker, your password never leaves the browser: only a fragment of its hash is sent. How is this possible? Thanks to the k-Anonymity model. We explain how it works and why an email is different.

The problem

To know if your password is in a breach database, the obvious solution would be to send it to the server and have it search. But that has a serious problem: you would be trusting your password to yet another service. If that service were compromised, your password would be exposed.

It's like asking "has my key been stolen?" by handing your key to a stranger.

The solution: k-Anonymity

The k-Anonymity model solves this elegantly:

Step 1: Hash the password

Your password is turned into a hash — an irreversible fixed-length string of characters. For example:

password → 5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8

This process is one-way: from the hash the original password cannot be reconstructed.

Step 2: Only a fragment is sent

From that full hash, only the first 5 characters are sent to the server:

Full hash: 5BAA61E4C9B93F3F0682250B6CF8331B7EE68FD8
Sent:      5BAA6

Step 3: The server responds with partial matches

The server searches for all hashes in its database that start with 5BAA6 and returns them. There can be hundreds or thousands of results.

Step 4: Comparison is done locally

Your browser (not the server) compares the full hash of your password with all the received results. If there is a match, it knows your password is in a breach. If not, you're clean.

Why is it called k-Anonymity?

Because your password "hides" among the k results returned by the server. If the server returns 500 hashes starting with 5BAA6, your password is indistinguishable from the other 499. It is anonymous within the group.

Visualization of the process

Imagine you want to know if your phone number is on a list, but you don't want to reveal it:

  1. Your number: 612 345 678
  2. You tell the operator: "Give me all numbers starting with 612"
  3. The operator gives you a list of 200 numbers starting with 612
  4. You check if yours is on the list

The operator never knew your exact number.

Is it really secure?

Yes, for several reasons:

  1. The server never sees your password — It only receives a fragment of the hash
  2. The hash is irreversible — The password cannot be reconstructed from it
  3. The fragment is ambiguous — Thousands of different passwords share the same hash prefix
  4. Comparison is local — Your browser does the final work, not the server

Do other services use it?

Yes. The k-Anonymity model was popularized by Have I Been Pwned with its Pwned Passwords service and is the industry standard for this type of query. Our password checker uses that same service.

Other applications of k-Anonymity:

  • Password managers that check if your password has been leaked
  • Browsers that check URLs against lists of malicious sites
  • Medical databases that share research data without identifying patients

What about emails?

For emails we don't use k-Anonymity: to look one up, it has to be sent. Our email checker sends it encrypted over HTTPS to our API, which checks it against Have I Been Pwned. We keep the result for up to 30 days to avoid repeating the lookup.

SecuryBlack's commitment to your privacy

  • Your passwords never leave your browser — Only a fragment of the hash is sent
  • Emails are only used for the lookup — And the result is deleted after 30 days at most
  • We use HTTPS — All traffic is encrypted in transit
  • We don't sell data — Never. Our business model is subscription-based, not your data

Want to check it for yourself? Try the password checker: your password never leaves your browser.

Blog

Find out what's wrong with your server

Connect your first VPS and get the security audit. Free during the beta.