Programming Assignment 3
Contents
Overview
In this PA, you will create a message encrypter and decrypter. You will pick a cipher that you find interesting and implement it within a program that 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.
For example, suppose I pick 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:
- uses an interesting cipher, with references to where you learned about the cipher
- produces a reasonable encryption
- can decrypt a file it created back to the original text
- it compiles and runs
- it takes the following command line arguments:
- a flag that is either
-e
for encoding or-d
for decoding - the name of the input file
- the name of the output file
- a flag that is either
- uses one or more well designed struct or classes
- uses well designed functions as needed
- uses pass-by-reference and pass-by-value appropriately
- is wholly of your own design and programming (i.e., don't work with others)
Milestones
Milestone 1: Planning and program skeleton
For this milestone, you will describe what cipher you will use and create a
skeleton complete with stubs and pseudo code. In your C++ file just below the
#include
statements, etc., add a comment that looks something like:
// CIPHER: I am use the ... cipher (see http://www....). It works as follows... // ...
In this comment, you should include what cipher you will use, references to where you learned about the cipher, and a short description of how it will work.
The C++ file should include:
- a definition for the struct or class you will use
- all necessary function/method declarations and stubs
- pseudo code inside of each function/method (including main) stub
- JavaDocs above each function/method definition
You program must compile and run.
Upload your C++ file to here. You can view the rubric here.
Milestone 2: 50% implemented
For this milestone, implement 50% of your functions and methods. Your program must compile and run.
Submit your .cpp file here. You can view the rubric here.
(Back to top)Milestone 3: Completed Project
Finish implementing your project and submit it. Your program must compile and run.
Submit your .cpp file here. You can view the rubric here.
(Back to top)