Skip to content
LearnEntropy

What is entropy in a secret? Bits of randomness

Also known asbits of entropyrandomness
Example. Kiteline is a fictional company.
On this page

Entropy, for a secret, is a measure of how unpredictable it is, expressed in bits: a value with n bits of entropy is one of 2ⁿ equally likely possibilities, so each extra bit doubles the number of guesses an attacker needs to be sure of finding it.

Where the idea comes from

NIST defines entropy as "a measure of the disorder or randomness in a closed system", with the formula from information theory (NIST glossary). For secrets, the practical version is simple: if every possible value is equally likely, entropy is log₂ of the number of possible values.

Counting it for random secrets

For a value made of characters chosen independently and uniformly at random, bits = length × log₂(alphabet size). For random bytes, it is simpler still: 8 bits per byte, whatever encoding you print them in.

SecretCharactersBits
16 random bytes as hex32128
32 random bytes as Base6444, with padding256
40 random letters and digits40about 238
random UUID, version 436122 random bits

The UUID line is a reminder that a random-looking format isn't always a secret format. RFC 9562 says implementations "SHOULD NOT assume that UUIDs are hard to guess" and that they "MUST NOT be used as security capabilities" (RFC 9562).

The formula only works for random choices

Entropy counts the choices behind a value, not the value itself. A 20-character password that a person made up has far less entropy than 20 random characters, because people choose words, dates and patterns that attackers try first. The same goes for a "random" key built with a non-secure generator, which may be predictable from earlier output; see CSPRNG.

So "how long is it?" is the wrong question. "How was it chosen, from how many possibilities?" is the right one.

How much is enough

256 bits matches the key size of AES-256 and the output of HMAC-SHA256, and is a common default for generated secrets; 128 bits is a usual floor. Values people must remember will always have much less, which is why systems that rely on passwords add something else, such as a random second secret or slow key derivation.

Common mistakes

  • Counting the encoding, not the bytes. Encoding 16 random bytes as Base64 makes the string longer, not stronger.
  • Using identifiers as secrets. UUIDs, timestamps and database IDs aren't designed to be unguessable.
  • Trusting a strength meter on a generated value instead of knowing how it was generated.

Entropy in Crunu

Your account key in Crunu is derived from your password and a Secret Key, a value generated on your device and never sent to the server. A Secret Key is written as K1- followed by groups of 6, 6, 5, 5, 5 and 5 characters from a 31-character alphabet that leaves out easily confused characters such as 0, 1, I and O. The first group is a non-secret account label, so the secret part is 26 characters: 26 × log₂ 31 ≈ 128.8 bits. Because every password guess against a stolen database would also need the Secret Key, a weak password alone isn't enough to break in. See Secret Key and key derivation.

The Generate button in the environment editor creates 40 random letters and digits, about 238 bits, with the browser's secure generator.

Sources

From the blog

  • Security

    Why a vault vendor can’t reset your password

    With a password and a Secret Key, nobody at the vendor can open your account, or reset it. How the Emergency Kit works, and what to do when something is lost.

    Who can decrypt guide

  • Security

    The web client problem: checking the code that decrypts

    A browser vault runs code the server sends on every visit. What a tampered page could see, which checks Crunu builds in, and what you can verify today.

    Who can decrypt guide

  • Migration

    HCP Vault Secrets is gone: choosing where to move

    HCP Vault Secrets reached end of life on July 1, 2026. HashiCorp's suggested paths, what Vault Community lacks, and how the alternatives differ on who decrypts.

    Who can decrypt guide