Why the most common prefix of hashed SHA1 passwords is 00000?
Master System Design with Codemia
Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.
Introduction
If a large password corpus seems to show 00000 as the most common five-character SHA1 prefix, that does not mean SHA1 has a built-in preference for leading zeroes. For a healthy cryptographic hash, short prefixes should be close to uniformly distributed, so a visibly interesting prefix such as 00000 is usually just a statistical winner in one dataset, or possibly an artifact of how the data was collected.
What a Five-Character Prefix Represents
SHA1 outputs 160 bits, usually written as 40 hexadecimal characters. A five-character hexadecimal prefix represents 20 bits, which means there are 16^5, or 1,048,576, possible prefixes.
If hashes are spread uniformly, each prefix bucket should get about the same share of a very large dataset. That does not mean every bucket will have exactly the same count. Random variation guarantees that some prefixes will be more common than others.
With hundreds of millions of hashes, the average bucket count may be fairly stable, but there will still be a maximum bucket somewhere. If that maximum happens to be 00000, the main reason it attracts attention is that humans notice repeating zeroes much more than they notice a prefix such as 4A4E8.
Why 00000 Is Not Cryptographically Special
A secure hash function should not systematically favor low prefixes, high prefixes, or any other visible pattern. If SHA1 really produced 00000 far more often than expected, that would be a major structural bias and would attract serious cryptographic scrutiny.
What usually happens instead is much less dramatic:
- every prefix bucket gets roughly similar counts
- one or two buckets land at the top by chance
- people remember the visually striking one
This is a classic case of pattern salience. A top bucket named 00000 feels meaningful, while an equally extreme bucket named B37AF feels random even though both are just labels.
A Small Simulation
You can see this effect by hashing many random inputs and counting only the first five hexadecimal characters.
In a run of only 200,000 hashes, many prefixes will not appear at all because there are more possible prefixes than samples. If you scale the sample size upward, the counts smooth out, but one prefix still has to be the largest. There is no reason that largest bucket cannot be 00000 in one particular dataset.
Dataset Effects Can Also Matter
If the counts come from breached-password collections rather than from ideal random inputs, there may be extra sources of variation beyond pure chance.
For example:
- the source datasets may contain duplicates of common passwords
- some breaches may be overrepresented
- the collection process may have applied filtering or sorting
- the published summary may report ties, not a unique winner
Those issues can change bucket counts slightly without implying anything fundamental about the SHA1 algorithm itself.
It is also worth remembering that password datasets are not random strings. They contain human choices such as 123456, reused passwords, and common patterns. Even so, once those inputs are passed through SHA1, the short-prefix distribution is still expected to look close to uniform unless there is some external artifact in the data pipeline.
What This Does and Does Not Say About Security
The prefix question is interesting, but it is not the main security lesson. The real issue is that SHA1 is not appropriate for password storage. Fast general-purpose hashes are cheap for attackers to compute at scale, which makes offline guessing much easier.
Modern password storage should use a password-specific scheme such as Argon2, scrypt, or bcrypt, ideally with unique salts and sensible work factors. Those defenses matter far more than whether one five-character SHA1 prefix edges out another in a breached corpus.
Common Pitfalls
The biggest mistake is assuming "most common prefix" implies "the algorithm prefers that prefix." In a large random experiment, some prefix must be most common.
Another mistake is forgetting how many buckets exist. With over one million possible five-hex-digit prefixes, the most common bucket is an extreme value from a large collection of near-equal candidates.
People also overread visual patterns. 00000 looks suspicious because zeroes are memorable, not because the hash is trying to produce them.
Finally, do not use observations like this to justify SHA1 for passwords. The correct takeaway is the opposite: avoid SHA1 for password hashing entirely.
Summary
- A five-character SHA1 prefix represents 20 bits and one of 1,048,576 possible buckets.
- '
00000being the most common bucket in one dataset does not imply a SHA1 bias.' - Random variation and human attention to obvious patterns explain most of the effect.
- Breached-password datasets can add collection artifacts on top of normal variation.
- The practical security takeaway is to use Argon2, scrypt, or bcrypt instead of SHA1 for passwords.

