Part 5 of 7 · 2 min read
Brute force arithmetic
Think of searching a library for one book by checking every shelf. If the library has a hundred shelves, you finish before lunch. If it has a billion, you never do. The analogy stops in one place: a searcher in a library can guess where to look first, and an attacker also tries likely passwords first.
In plain words: A brute-force search tries every password of a given kind. The number of passwords is the size of the alphabet to the power of the length. The time is that number divided by the guesses per second. Lengthening a password multiplies the space by the alphabet size for each extra character, which is far stronger than making the hash a little slower. Dictionary attacks try likely passwords first and so beat short and common choices at once, whatever the space.
A worked example (made up to show the idea). Suppose an attacker has 10,000 cores that each match the speed of the test machine (rounded rates of 71 and 588 per core). For yescrypt at 71 guesses per second per core, that is 710,000 guesses per second. For SHA-512 crypt at 588 per core it is 5,880,000. The table shows the time to try the whole space.
| Password kind | Space | yescrypt (710,000/s) | SHA-512 crypt (5,880,000/s) |
|---|---|---|---|
| 6 lowercase letters | 26^6 = 308,915,776 | 435 s (7 minutes) | 53 s |
| 8 lowercase letters | 26^8 = 208,827,064,576 | 294,123 s (3.4 days) | 35,515 s (9.9 hours) |
| 8 letters and digits | 62^8 = 218,340,105,584,896 | 3.08 x 10^8 s (9.8 years) | 3.7 x 10^7 s (1.2 years) |
A password of 6 lowercase letters falls in minutes, and 8 lowercase ones in days. Adding a mix of letters and digits to 8 characters moves the time to years. Each extra character multiplies the work by 62.
The key lines. Real users do not pick passwords at random, so a dictionary search finds many in seconds. Length and randomness matter more than any one rule about symbols. A password manager that makes long random passwords solves both problems.
Brute-force attack
A brute-force attack is a search that tries every possible secret of a kind until one works. Its time is the size of the space divided by the number of guesses per second, so it grows exponentially with the length of the secret.
Example: the 8-letter lowercase space has 26^8 = 208,827,064,576 passwords.
Common mistake
Adding a symbol to a short, common word does not make it strong. Attackers try those substitutions first. A long random string, or four or five unrelated words, has far more unpredictability than a clever change to one word.
Check yourself: 1. How many passwords are there of 6 lowercase letters? 2. By what factor does each extra character from 62 symbols multiply the work? 3. Why does a dictionary attack beat the brute-force estimate for human choices?