Question: Background: The Caesar Cipher, said to be invented by Julius Caesar and was used by the ancient Roman Legion, is the earliest known method of

Background: The Caesar Cipher, said to be invented by Julius Caesar and was used by the ancient Roman Legion, is the earliest known method of "encrypting" a message (the "plaintext") to something that is unintelligible (the "cipertext") by using a secret number (the "key") which is only known to the sender (Alice) and the expected receiver (Bob) of that message, but no one else.
The cipher works as such: first of all, Alice performs an "encryption" using the shared key. And after the encrypted message is delivered to Bob. Now, when Bob receives the message, he will apply the key to the cipher to perform a "decryption" and recover the original message fairly quickly and easily. However, if the message somehow was obtained by an adversary (Cate) in the middle, since Cate does not have the key, it will take her quite some effort to find out the original message. As well as that, if Cate altered the ciphertext, Bob will for sure know that, as the decrypted text from that altered one will most likely have no meanings.
In this project, you are asked to implement such a cipher with the said encryption and decryption functionalities on text and key being typed in from the keyboard.
Description: The flow of the program looks like this:
At the beginning of the program, you will be asked to type in either "E"/"D" for calling the corresponding encryption/decryption protocol via the prompt "Please select mode [E/D]:".
Then, in either case, you will be asked to input a string via the prompt "Please enter the plain/ciphertext ", where the string is terminated by an enter, or x 0 A in LC-3.
Then, similarly, you will be asked to type in the key, a number ranging from 0-9, via the prompt "Please enter the key (0-9): ".
Lastly, depending on the initial selection, the system will print to the console either the encrypted/decrypted message with promopt "The encrypted/decrpted message is: ......"," where the dots represent the ciphertext/plaintext.
To give a specific use case scenario: We choose encryption with plaintext "HelloWorld" (let's focus on letters only, upper and lower cases) with key being 5. After the program execution, the ciphertext with prompt "The encrypted message is: MjqqtBtwqi" should be printed to the console.
Background: The Caesar Cipher, said to be

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 Programming Questions!