Home / Knowledge hub / Entropy
Knowledge hub
Entropy
How unpredictable a value is, which decides how hard it is to guess.
What it means
In security, entropy measures how unpredictable a value is. It is counted in bits. A value with 40 bits of entropy could be any of about a trillion possibilities, so an attacker who tries them in a sensible order needs on average about half that many guesses.
The number describes how the value was chosen, not how it looks on screen. A 20-character string made from a name and a date has little entropy. Sixteen bytes drawn from a secure generator has 128 bits, far beyond any guesser.
Why it matters
Entropy sets the price of guessing. A six-digit code has about 20 bits, which is why it must be paired with attempt limits and a short life. A 128-bit random token cannot be found by trying, even at huge speeds. Many breaches begin with a secret that was far weaker than it looked.
It also explains why length alone reassures wrongly. A long password built from a pattern, or a token derived from a user id and the time, can be guessed in a fraction of the effort. Audits that count characters miss this entirely.
How it shows up
It appears in session identifiers, reset links, invitation codes, API keys, one-time codes and password rules. OWASP asks for at least 64 bits of entropy in a session identifier. For anything that grants access without a second factor, pick far more than the minimum.
Problems repeat: short numeric codes with no rate limit, tokens from counters or timestamps, passwords chosen by people with predictable habits, and keys derived from a human phrase. Check how each secret is produced, how many guesses are allowed, and whether the process slows a guesser down.
Questions people ask
Entropy, answered
How many bits of entropy are enough?
It depends on what the secret protects and how many guesses an attacker gets. Session identifiers need at least 64 bits by OWASP guidance; keys and long-lived tokens are normally 128 bits or more.
Short codes can be acceptable only if guesses are limited and codes expire quickly.
Is a longer password always higher entropy?
No. Entropy comes from unpredictability. A long phrase made of common words in a common order may have little. A shorter value from a random generator can have more.
Random choice matters more than character count.
What is the entropy of a six-digit code?
A six-digit numeric code has one million possibilities, which is about 20 bits. That is small, and it is only safe because a good system limits attempts and expires the code quickly.
Without those limits it can be guessed in a short time.
Is entropy the same as randomness?
They are related. Randomness is a property of how a value was produced; entropy is a measure of how much uncertainty it carries. A value drawn from a good random source has high entropy.
A value that merely looks random might not.
How is a low-entropy secret found in a test?
A tester looks for patterns across a sample of tokens, tries common values, and checks whether attempts are limited. If a secret can be found by guessing at a realistic rate, the finding includes the proof.
Without attempt limits, even decent secrets become weak.
Related
Terms that sit next to this one
CSPRNG
A random number generator safe to use for secrets, tokens and keys.
Predictable randomness
Tokens or codes made from a generator an attacker can work out or guess.
Brute force
Trying passwords or codes over and over until one of them works.
Session token
A random value the browser sends to show it belongs to a signed-in visit.
Rate limiting
Capping how often something can be attempted, per user or per address.
How many guesses would it take?
We test whether tokens, codes and reset links your app issues can be guessed at a realistic rate, and we only report what we managed to find. Ask us to run it on one of your applications.
Or start with a $199 pilot on one application: thirty days, success criteria agreed before day one, credited against the annual if you convert.