Lesson 5 of 817th century–today7 min
Combinatorics: counting without listing
A password policy allows 8 characters drawn from 62 symbols: 26 lower-case letters, 26 upper-case and 10 digits. How many passwords is that? Listing them is out of the question. Counting them takes one line: 62⁸ = 218,340,105,584,896, about 2.2 × 10¹⁴.
Whether a brute-force attack is hopeless or a weekend's work depends on that number and the attacker's guess rate. Counting arguments decide the size of a key space, the probability of a hash collision and the running time of an algorithm that tries every arrangement.
The rest of this lesson is part of Pro
Create a free account to read the first lesson of every path, and go Pro for the rest.
Sources
- 6.042J Mathematics for Computer Science (Lehman, Leighton, Meyer): counting — MIT OpenCourseWare
- math: comb() and perm() — Python documentation
- Computer Science Curricula 2023 (ACM/IEEE-CS/AAAI) — ACM