I use KeePassXC to generate and store passwords. For example, generating a password with a length of 128 characters without using the extended ASCII character table, the entropy is about 770 - 800 bits. I have read that entropy in cryptography is a measure of the randomness or diversity of a data-generating function. But why in bits and how is this number calculated?

  • 1
    Why in bits? Because it's convenient. Instead of having to write "This password has an entropy of 18,446,744,073,709,551,616" you can say "It has 64 bits of entropy".
    – nobody
    Aug 6, 2021 at 19:24
  • 1
    Oh, I got it, i = log2(x) where i is quantity of bits, thanks.
    – dokichan
    Aug 6, 2021 at 19:32

1 Answer 1


The reason we measure entropy in bits is because it's a convenient measure when working with computers. Each additional bit of entropy adds twice as many possibilities. So if, for example, a secret has 8 bits of entropy, then there are 256 (2^8) possibilities it could be.

Now, those 256 possibilities don't have to be exactly 8 bits (a byte long). Picking uniformly from the set of strings from "1" to "256" would also provide a string with this much entropy. What essentially matters is that the set of input strings, however we define or encode them, comes from a set of the appropriate size.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .