# Code Cracking

1. Aug 26, 2007

### Raza

Hi,
I have recently cracked a password for a zip file using brute force which got me thinking. Lets say that the password is only 3 digits, how many outcome could it possibly have?
I know it's 999 but is there a equation that I can use to figure this out?
or lets say that it contains only 3 alphabets, how many outcome could it possibly have, or lets say that the password's length is three characters and it could have either alphabets or numbers, what are the possible outcome?

Please give me brief explanation and some equation.

Thanks

2. Aug 26, 2007

### matticus

in general, if you have a items with b places to but them, the number of outcomes is a^b.

for 3 digits there are actually 10^3= 1000 different choices (which can easily be seen by considering it is 000=choice 1, 001 = choice 2,...999= choice 1000).

if a password is 3 characters and can have alphabets or numbers, it is (26+10)^3.

these questions become harder if you start putting restrictions on order.

3. Aug 26, 2007

### Staff: Mentor

For each position, you know how many possible options there are, so you just multiply out to get the total number of possible results.

Like, if you have a single number position, and you are working in base 10, then there are 10 possible results, 0-9.

If you have a 2-digit number, then each position (the 1's postion and the 10's position) has 10 possibilities, so you get a total of 10 * 10 = 100 possible results (0-99).

If you have a capital character position, A-Z, that position has 26 possible outcomes. Two capital letter positions have 26 * 26 possible outcomes, etc.

So as a final example, in California, the standard license plates are formatted like this:

<1 number> <3 chars> <3 numbers>

So the total number of possible plates in that format would be 10 * 26^3 * 10^3.

Makes sense?

EDIT -- matticus beat me to it!

4. Aug 26, 2007

### Raza

Thanks, I got it.
It's simply amazing how math works.
Right now, I am cracking another zip password, which is 12 characters, alphabets and numbers, so it would be (10+26)12,right?

5. Aug 26, 2007