Choose a substitution cipher and call it CIPHER. Write a C program that implements your CIPHER. Write a C program CRACKER that uses the letter frequency count method to decrypt the ciphertext generated by your CIPHER. CRACKER should take as input a ciphertext ctext generated by CIPHER and return a "decrypted" form of ctext. The decryption is not expected to be perfect! You may hard code your input plaintext or read it from a file. Your CIPHER and CRACKER should not remove blanks, capitalizations, and punctuation marks! You do not have to encrypt digits.
A table containing the relative frequencies of English letters can be found at http://www.math.cornell.edu/~mec/2003-2004/cryptography/subs/frequencies.html.
Answer the following questions:
(Q1) What is the key for your cipher?
(Q2) Was your cracker able to recover all of the plaintext with no errors? Why or why not?
(Q3) Suggest a way of modifying the basic letter frequency count attack to make the output of cracker more similar to the original plaintext.
Compilable source code for CIPHER (name your source file to indicate which compiler/version you used). The code must compile with no errors in order to receive credit for this question. CIPHER must implement the functionality of a substitution cipher as described in Stamp (Shift the English alphabet by n, or use any permutation of the alphabet as your symmetric key).
Compilable source code for CRACKER (indicate which compiler/version you used). The code must compile with no errors in order to receive credit for this question. CRACKER must implement the functionality of a letter-frequency count cracker as described in Stamp.
A text file plaintext.txt containing the plaintext you chose to encrypt
A text file ciphertext.txt containing the ciphertext generated by CIPHER
A text file cracked.txt containing the plaintext generated by CRACKER on input the ciphertext
A screen snapshot of a sample run of CIPHER and a screen snapshot of a sample run of CRACKER.
Modify your plaintext and/or the implementation of your basic letter frequency count cracker to help CRACKER generate an output that is closer to your plaintext. Were you able to improve the cracking capabilities of your cracker?