Contents

Overview

In this PA, you will create a message cipher which will allow both encrypting and decrypting a message. I will assign you the particular cipher to implement. Your program will take a text file as input, run it through the cipher, and write the encrypted output to a different text file. The program will also run in reverse, taking an encrypted file as input, running it through the decipher, and writing the output to another file. You will use command line arguments to read in the input and output file names, as well as whether the user wants to encrypt or decrypt the input file. A starter program is provided to help with the aspects of the program that we haven't gotten to in class.

For example, suppose I am assigned a transposition cipher that transposes the characters in every distinct adjacent pair of characters in the input text. Supposing I have the following text in a file named message.txt:

The quick brown fox jumps over the lazy dog.

Running my program as follows:

$ hanks-cipher -e message.txt encrypted-message.txt

will create the file encrypted-message.txt with the following content:

ht euqci krbwo nof xujpm svoret ehl za yod.g

To decrypt the encrypted text and save it to a file name original-message.txt, I would do:

$ hanks-cipher -d encrypted-message.txt original-message.txt

The contents of original-message.txt are the same as message.txt:

The quick brown fox jumps over the lazy dog.
(Back to top)

Specifications

Your completed submission must meet the following requirements:

You can find the starter code in the Zovy class folder under the name pa2-starter.cpp.

(Back to top)

Submission

Submit your .cpp file here.

(Back to top)