Question: Very challenging Assignment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Please Help One of the simplest examples of an encryption technology is the Caesar cipher, which was used by Julius Caesar

Very challenging Assignment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Please Help

One of the simplest examples of an encryption technology is the Caesar cipher, which was used by Julius Caesar to communicate with his armies. Caesar is considered to be one of the first persons to have ever employed encryption for the sake of securing messages. Caesar decided that shifting each letter in the message by 3 would be his standard algorithm. He informed all of his generals of his decision in private. Then he was able to send them secured messages over long distances without worrying that the messages might be intercepted. Using the Caesar Shift (3 to the right), the message: "Return to Rome" would be encrypted as: "Uhwxuq wr Urph".

Note that only letters are encoded. Punctuation, numbers, spaces, newlines, and so forth are not encoded. Lower case letters are encoded into lower case letters, and upper-case letters are encoded into upper-case letters. Also, note that the encoding system wraps around at z and Z. So the letter Y is encoded as B using a Caesar Shift (3 to the right). Y + 1 = Z, Z + 1 = A, and A + 1 = B. You can use modulo for this process (see below).

There are many references to the Caesar Cipher in the literature, which you can find if you search Google.

Assignment

Your assignment is to create a program that will give the user an option to encrypt a plain text file, or decrypt a cipher file, both of which are to be found in the working directory (so no directory path information necessary). If the user specifies encryption, then your program will encrypt a plain text file (chosen by the user) using Caesar cipher, and write the cipher file out to the screen and to disk (output file name also chosen by the user). Caesar used a shift of 3, but your program will ask the user for a reasonable shift value (reasonable being somewhere between 1 and 15 or so). To encrypt using a shift of 5 for example, all the letters in the plaintext file would be shifted 5 letters to the right. If the user specifies decryption, then your program will ask the user for the reverse shift and decrypt the chosen file to produce a plain text file on disk, and also written to screen. Decrypting with a reverse shift of 5 would shift all the letters 5 places to the left. Terminate the program if one of the files dont open. Check to make sure that the shift value is a positive number (check for input failure and negative values). Remember to ignore non-letters, such as numbers, spaces, return, punctuation, etc. See the sample output below.

Sample Output:

Example 1, Encrypt

Welcome to the Caesar cipher program.

Would you like to encrypt or decrypt a file? (e/d): e

What is the shift value that you would like to use?: 5

Please tell me the name of the file to encrypt: PlainText.txt

Please tell me the name of the cipher file to write: Cipher.txt

Output of the cipher text:

(Psthp psthp) Ujssd, (Psthp psthp) Ujssd, (Psthp psthp) Ujssd

Gtb ynjx fwj httq.

[Qzpj] N hfs'y gjqnjaj ny! [Dtif] Ymfy nx bmd dtz kfnq.

Ifrrny Onr, N'r f ithytw sty f gwnhpqfdjw!

Example 2, Decrypt

Welcome to the Caesar cipher program.

Would you like to encrypt or decrypt a file? (e/d): d

What is the shift value that you would like to use?: 5

Please tell me the name of the file to decrypt: Cipher.txt

Please tell me the name of the plaintext file to write: PlainTextOut.txt

Output of the plain text:

(Knock knock) Penny, (Knock knock) Penny, (Knock knock) Penny

Bow ties are cool.

[Luke] I can't believe it! [Yoda] That is why you fail.

Dammit Jim, I'm a doctor not a bricklayer!

Example 3, Error

Welcome to the Caesar cipher program.

Would you like to encrypt or decrypt a file? (e/d): e

What is the shift value that you would like to use?: 5

Please tell me the name of the file to encrypt: FileThatDoesNotExist.txt

Please tell me the name of the cipher file to write: OtherNonExistentFile.txt

Sorry, can't open the input and/or output files. Exiting.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!