C# program
CS 313 02
Program Assignment 03
Chapter 08
Due: Wednesday, February 21, 2018
The Caesar cipher is one of the earliest known and simplest ciphers. It is a type of substitution cipher in which each letter in the plaintext is 'shifted' a certain number of places down the alphabet. For example, with a shift of 1, A would be replaced by B, B would become C, and so on. The method is named after Julius Caesar, who apparently used it to communicate with his generals.
To pass an encrypted message from one person to another, it is first necessary that both parties have the 'key' for the cipher, so that the sender may encrypt it and the receiver may decrypt it. For the Caesar cipher, the key is the number of characters to shift the cipher alphabet.
Here is a quick example of the encryption and decryption steps involved with the Caesar cipher. The text we will encrypt is 'defend the east wall of the castle, by sending 50 more soldiers there', with a shift (key) of 1.
plaintext: defend the east wall of the castle, by sending 50 more soldiers there
ciphertext: FGHGPF VJG GCUV YCNN QH VJG ECUVNG, DA UGPFKPI 61 OQTG UQNFKGTU VJGTG
Write a C# program that allows the user to enter the following information into text boxes:
Whether they want to encrypt a message or decrypt a message
The key value (1 – 20)
The filename where the original message is located
Add the following comments to the beginning of the program.
Name: Your Name
Class and Section: CS 313 02
Assignment: Program Assignment 03
Due Date: See above
Date Turned in:
Program Description: You write a short description of what the program will do
Extra Credit 5 points:
Add punctuation (. , ? ! ;) and a space as part of the characters of the available alphabet and part of the cipher. So the above message would cipher to:
FGHGPFBVJGBGCUVBYCNNBQHBVJGBECUVNG!BD0BUGPFKPIB72BOQTGBUQNFKGTUBVJGTG