1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Code Cracking

  1. Aug 26, 2007 #1
    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.

  2. jcsd
  3. Aug 26, 2007 #2
    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.
  4. Aug 26, 2007 #3


    User Avatar

    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!
  5. Aug 26, 2007 #4
    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?
  6. Aug 26, 2007 #5


    User Avatar

    Staff: Mentor

    So now you're asking for help hacking passwords.... :rolleyes:

    No, sorry, your answer is all wrong. It should be the two's-complement of that number to be correct. :bugeye:
  7. Aug 27, 2007 #6


    User Avatar
    Science Advisor
    Homework Helper

    36^12 if all letters are known to be lowercase (or case-insensitive); 62^12 if letters can be of any case.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook