The number of possible passwords with a character set of
size C and a password length x is Cx.
For instance, with mixed case
alphanumeric passwords we have a character set that has 62 possible characters:
26 lower case letters, 26 upper case letters and 10 numbers (26 + 26 + 10 = 62). If a password is 8 characters long, there are
628 = 62 ∙ 62 ∙ 62 ∙ 62 ∙ 62 ∙
62 ∙ 62 ∙ 62 possible combinations.
If there are P
possible passwords and we can guess G
passwords per second, then it will take us P
÷ G seconds to guess all possible passwords. Since there are 86,400 seconds in a day, the
number of days that it will take us is P ÷
(G ∙ 86,400) and the number of years is P
÷ (G ∙ 86,400 ∙ 365).
The number of guesses that an attacker can make per second
depends mostly on the password hashing algorithm. For a fast algorithm like MD5, a reasonable
cracking speed is several billion guesses per second. For bcrypt or scrypt, a reasonable speed
might be from a few hundred to a few thousand guesses per second.
Example:
Number of possible 8 character mixed-case alphanumeric passwords = 628
= 218,340,105,584,896
Seconds to guess all possible passwords (1 billion per
second) = 628 ÷ 1,000,000,000 = 218,340
seconds.
Days to guess all possible passwords = 218,340 ÷ 86400 = 2.523 days.
Years to guess all possible = 2.523 ÷ 365 = .007 years