99Technology

Why long passwords are strong

The number of guesses a password needs grows with every extra place. See the sums for length, for random words and for passwords that follow a habit. The speeds are made up, and this is not security advice.

The vault door

A lock with no key, only guesses

Someone who wants to get into an account without the password has only one way: guess. A guess costs a little time, and the number of guesses needed depends on how many possible passwords there are. This page is about that sum. It explains the maths and is not security advice. For your own accounts, follow the guidance of the service you use.

Three locks on the vault door. On the first, see how the number of tries grows with each extra place in the password. On the second, compare a few random words with random characters. On the third, see why a password that follows a habit is weaker than it looks. The speeds and the sizes of the habits on this page are round numbers made up for the page. Without a script each lock shows one picture or table.

First lock

Every extra place multiplies the tries

A password made of random characters has as many possibilities as the number of choices for each place, multiplied once for every place. Eight places with 26 choices give 26 to the power 8, which is about 209 billion. Add one more place and the number is multiplied by 26 again. Strength is often written in bits. Each bit doubles the number of tries.

Pick the set of characters and slide the length. The page shows the bits and the average time to hit the right password for three kinds of attacker. The speeds are made up: one guess a second for a web login that limits the guesses, ten thousand a second for a stolen file protected by a slow hash, and ten billion a second for a stolen file with a fast hash. Real speeds differ and sources give different figures.

8 places, 26 choices for eachEach place multiplies the number of tries by 26
Bits and average time to guess, for random lowercase letters of three lengths
Lowercase lettersBitsStolen file, slow hash
628.24 hours
837.6121 days
1256.4151 thousand years

8 random lowercase letters give 37.6 bits. Average time to hit it, at made-up speeds: a web login with limits, 3 thousand years; a stolen file with a slow hash, 121 days; a stolen file with a fast hash, 10 seconds.

Second lock

Words against characters

A password can be made of random words as well as random characters. A list of 7776 words, as used for dice-picked passphrases, gives about 12.9 bits for each word, because 7776 is 6 to the power 5. Four words picked at random give about 51.7 bits, as much as eight random characters from all 94 keys on a keyboard, which give about 52.4 bits.

Slide the number of words and the number of characters. The words are easier to remember and to type, but only if they are really picked at random, by dice or by a program, and not chosen by a person. A phrase from a song or a saying does not count as random.

Four random words51.78 random characters from 9452.4Strength in bits (longer bar, harder)
Bits for words and for random characters
PasswordBits
2 random words25.8
4 random words51.7
5 random words64.6
6 random words77.5
8 random characters from 9452.4

4 random words give 51.7 bits and 8 random characters give 52.4 bits.

Third lock

A habit is not random

An attacker does not try passwords in a random order. They try the likely ones first: common passwords, words with a number added, names and dates. A password that follows a habit has few real possibilities, however complicated it looks. A word, a capital, two digits and a symbol has the look of a strong password and the strength of a weak one.

Pick a kind of password. The page shows its strength in bits and the time to guess it at the speed of a stolen file with a fast hash. The sizes of the sets of habits are made up. Real attackers use lists of passwords that have leaked in the past, and some services block those passwords for that reason.

Random, 8 characters from 9452.4Four random words51.7A common word, a capital, two digits and a symbol27.6A birthday as digits15.2Strength in bits (longer bar, harder)
Four kinds of password, their bits and the time to guess at the speed of a stolen file with a fast hash
KindBitsFast hash
Random, 8 characters from 9452.44 days
Four random words51.72 days
A common word, a capital, two digits and a symbol27.6less than a second
A birthday as digits15.2less than a second

Press a kind of password.

Key takeaways

  1. The strength of a random password is its length times the base 2 logarithm of the size of the set it is drawn from. Each bit doubles the tries.
  2. One more place multiplies the number of tries by the size of the set. Length matters more than odd mixes of characters.
  3. Four words picked at random from 7776 are about as strong as eight random characters from 94.
  4. A password that follows a habit has far fewer real possibilities than it looks.
  5. The speeds of the attacks on this page are made up. The page explains the maths and gives no security advice.

Sources

Some of these sites could not be opened while this page was written, so some facts were checked through search results that quote them. That strength is the length times the base 2 logarithm of the size of the set, and the arithmetic of 26 to the 8 and 94 to the 8, are plain maths and were computed. That guidance has moved from forced mixes of characters towards length, that it asks services to block passwords that have leaked and to limit failed guesses, and that passwords should be stored hashed, appeared in several places, but sources disagree on the exact minimum length (8, 12 or 15), so the page gives none. That slow hashes cut the speed of a stolen file attack from billions of guesses a second to thousands, that a web login can be limited, and that attackers try likely passwords first, appeared in several places. The speeds on the page, one a second, ten thousand a second and ten billion a second, are round numbers made up for the page, inspired by the order of magnitude in the sources. A word list of 7776 words and 12.9 bits a word is general knowledge about dice-picked passphrases and was not confirmed in the search, so the page says only that such lists are used. The sizes of the sets of habits are made up. Nothing here is security advice.