Program 2, How long will that take?
Short Description:
Write a program which will estimate the time required to crack a password using brute force.
This assignment is worth 50 points.
Goals
When you finish this homework, you should have:
- Demonstrated your ability to use the integer and floating point data types.
- Demonstrated your ability to convert between floating point numbers and integers.
- Continued to develop your programming ability.
Formal Description
Write a program which will estimate the amount of time required to crack a password. Your program should begin by prompting the user for data related to the password:
- The number of letters in the alphabet from which the password will be selected.
- The number of letters in the password.
- The number of instructions per second the computer can execute
- The number of instructions required to test a password.
Assume that password rules require you to use unique letters in a password. For example, if the user tells you that they have three letters in their password, then this password is composed of three distinct letters.
This is called a permutation, and can be calculated using the formula n!/(n-r)!, where n is the number of letters in the alphabet and r is the number of letters in the password. You might look at problem 3 on page 132 for computing n!.
You should report to the user
- The number of passwords possible with their input
- The number of seconds required to check all possible passwords
- The number of years, days, hours, minutes and seconds required to check all possible passwords.
Remember, your output must be organized, well labeled and easy to read.
Discussion
Be careful of your input, it will be easy to overflow an int with this program. Perhaps you might want to use something larger than an int for some of your computations.
Your identifiers should be constructed properly, with meaningful names.
You should document your code with comments.
Your output should be organized, easy to read, and make appropriate use of white space.
Design
See homework number 7.
Required Files
A single source code file.
Submission
Email your final source code file to danbennett360@gmail.com.