Assignment 1 “Simple Encryptor” CS 121 Spring 2013 In this assignment, you will write a program that performs a simple encryption on a file. We will take advantage of the fact that given a sequence of ones and zeros, if you XOR it with a given key (another sequence of ones and zeros), the results will almost always be changed. Moreover, the new scrambled sequence of ones and zeros will be returned to the original data if XOR with the same key is applied again. Thus, by generating a random key, and performing XOR on every byte of the file we can quickly and easily scramble the contents. The process is easily reversed by performing XOR on the scrambled data with the same key. We want to process the data in bytes, so use the char data type for all your reading and writing of files. Write a C++ program that 1) Prompts the user for a choice of encrypt or decrypt 2) Prompts for the input and output filenames 3) Has a function for encryption a. Generates a random key b. Stores the key in the encrypted file c. Encrypts the data from the input file by performing XOR of the key with every byte from the input file 4) Has a function for decryption a. Reads the key from the encrypted file b. Decrypts the data from the input file by performing XOR of the key with every byte from the file. 5) Performs the encryption or decryption based on the user’s choice. File I/O must be in text mode (i.e. do not open the file(s) for binary input / output) BE SURE TO TEST YOUR PROGRAMS!!! BONUS!!!! Occasionally, when we encrypt we accidentally generate the DOS end of file character. This causes problems when we try to decrypt, as the entire file will not be read. For an additional 10 points, check to make sure that your encryption does not create the DOS eof character. If it does, create a new key and re-encrypt the file. Note: The DOS eof character is hex 1A. You can initialize a char to this value to check against the encrypted characters you generate. Ex: char dosEOF = 0x1a;