# How long does the password be to have n-bits entropy?

It is said that a password has n-bits entropy if its entropy corresponds to the entropy of an n-bit number, the digits of which are independently drawn under uniform distribution. How long does a password, whose letters from an alphabet {a,b,...,z} is independently chosen under uniform distribution, be at least to have n-bits entropy?

• This is a quite basic question. I'd hate to just give you the answer. I'm assuming you are familiar with shannon's entropy equation. You can apply that to compute the bits of entropy per sample. From that you can compute the number of samples to get n-bits of entropy. – mikeazo May 11 '17 at 13:59
• Excuse me for my lack of understanding and misconception. But in this case, what does "n-bit entropy" mean? Does it mean the entropy of an n-bit number? Or does it mean an entropy result that has an n-bit number? – Sam May 11 '17 at 14:56
• $n/\log_2(26)$ where $\log_2$ is the base-2 logarithm. – CodesInChaos May 11 '17 at 15:25
• An n-bit number chosen uniformly at random has n-bits of entropy. So it is asking how many characters in a password of all lower case letters would you need to have the same number of bits of entropy. – mikeazo May 11 '17 at 15:33
• The calculation by @CodesInChaos is the correct one, the result is 4.7 bits of entropy per character, so n/4.7 rounded up to an integer – Richie Frame May 12 '17 at 1:03

## 1 Answer

Computing the entropy of a password is not an easy task. All the comments at the time of writing assume a random selected password, as suggested in the question. In this case all the characters will have equal probability and the length is just the total entropy divided by the entropy of a character.

Note, however, that the process of breaking the password is normally not attacked by brute force, but with dictionary-based and similar approaches. See the answer How should I calculate the entropy of a password?. Therefore, in a dictionary-based schema every character (and word) will have a different probability. Additionally, and this is the cause for the use of the mentioned dictionary schemes, most of the real world password are not randomly selected (see https://xkcd.com/936/).