Cybersecurity basics · Lesson 1 of 3
Cybersecurity basics · Lesson 1 of 3
An attacker who guesses passwords by trying every combination needs, in the worst case, pool ** length tries, where pool is the number of possible characters. Lowercase letters give 26, uppercase another 26, digits 10, and the 32 punctuation symbols on a keyboard another 32.
Length grows the count much faster than variety: each extra character multiplies it by the whole pool. A long passphrase of ordinary words is usually stronger, and easier to remember, than a short jumble.
This count is an upper bound. Real attackers try common passwords and leaked ones first, so Password1! falls in seconds whatever the formula says. Use a password manager and a different password for each site.
Write pool_size(pw) (26 if it has a lowercase letter, plus 26 for uppercase, 10 for digits, 32 for punctuation) and search_space(pw), which returns pool_size(pw) ** len(pw).
All checks pass. Well done.
Next lesson: How sites should store passwordsAn AI tutor that gives hints, not answers. It sees your code, its output and this lesson. It can be wrong.