Program 4,!?.

Short Description:

Write a program which will approximate the amount of time required to try all possible passwords of a given length.

This assignment is worth 30 points.

Goals

When you finish this homework, you should:

Formal Description

You have been hired by the Middle Insight Directorate (MID) to analyze the security of passwords. Your task is to compute how long it will take to perform a brute force attack on MID's password system. In this case a brute force attack consists of trying all possible passwords.

A password on the MID computer must be exactly r characters long and should be chosen from n different characters. The system does not allow characters in a password to be reused.

So if the legal letters are {a, b, c, d} and each password is two letters long, the possible passwords are:

   ab ac ad bc bd ba cd ca cb da db dc

You have discovered, that this is known as a permutation, written nPr = n!/(n-r)!. See exercise 3 page 132 for an explanation of n!.

In the above example n = 4, r = 2 so 4P2 = 4!/(4-2)! = 12 passwords.

Right now, the MID computer can execute 2x109 instructions per second, but that may change in the future. It is possible to check a password using 3,000 instructions, but that may change as well. You do not want to input these numbers, but should make it easy to change in your program.

Continuing with the above example, it would take 12 passwords * 3,000 instrucions/password = or 36,000 instructions to try all 12 passwords. This would take

                1 second
36,000 inst x  ---------- = 1.8 x 10-6 seconds = 18 microseconds 
              2x109 instr 

Your program should begin by asking how many letters the user may choose from. It should next ask the length of a password. With this information, your program should compute approximately how many years it will take to try all possible passwords.

A typical run of your program might look like this:

Enter the number of letters to choose from=> 76
Enter the number of letters in a password => 9
Selecting passwords which are 9 letters long from an alphabet of 76 letters 

There are about 5.17e+16 password possible.
That would take about 7.76e+10 seconds, or about 2458 years.

Discussion

Design

You should design this program, including an program design, before you implement the code. This design should be a submitted on Friday March 23, and should include: Please print this design document and hand it in at the beginning of class.

Required Files

A single source code file.

Submission

Email your final source code file to danbennett360@gmail.com.