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?

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.