Question
Programming assignment -- Write a program in either Java or Python that will brute force crack an Affine cipher. In other words, it should try
Programming assignment -- Write a program in either Java or Python that will brute force crack an Affine cipher. In other words, it should try for each 12 alpha values {1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25}, each of the 26 possible beta values {0 .. 25}. Your program should just decrypt the ciphertext according to all possible key values. You can manually scan the output from your program to determine the correct key and the decrypted message. Test your program using the ciphertext contained in the provided file ciphertext.txt. Identify the source of the original plaintext and what key was used to encrypt the message.
Some hints:
1. The ciphertext is in all caps (per convention), but you can always convert the ciphertext string to all uppercase to start. Then your program can assume all of the ciphertext are capital letters.
2. The ASCII code for the capital letters 'A' through 'Z' are 65 through 90, inclusive. So if you subtract 65 from the value of a capital letter character, you should get the corresponding numerical code for the letter (0 through 25).
3. The ASCII code for the lower case letters 'a' through 'z' are 97 through 122, inclusive. So if you add 97 to the numerical code for the letter, you should get the corresponding lower case letter.
4. The multiplicative inverses for each of the possible alpha values are as follows:
o 1
o 3, 9
o 5, 21
o 7, 15
o 11, 19
o 17, 23
o 25
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started