Question: Assignment Summary In this assignment, you will develop a program in C++ that encrypts a file and decrypts a file using your implementation of the

Assignment Summary

In this assignment, you will develop a program in C++ that encrypts a file and decrypts a file using your implementation of the RC4 stream cipher algorithm. This algorithm is described in the Stamp textbook on pages 55-56.

On the command line, the user will put the program name followed by three entries: a key string of 1-to-256 ASCII alpha-numeric characters, a source file name, and a target file name as shown in the usage message below.

Usage: a.exe

Example: a.exe AbCd1e2Z3 fileA.txt fileB.txt

If any of this information is missing, the program shall immediately print a usage message to standard error and terminate.

If the key entered on the command line exceeds 256 characters, the program shall ignore the remaining characters.

After the program finishes encrypting/decrypting the source file, it shall print a message to standard error saying "RC4 stream cipher operation is done", and then terminate normally.

Design and Implementation Constraints

Follow the same constraints given in Assignment #1

Open the source file in binary read mode and the target file in binary write mode

Use the fread() and fwrite() functions to read/write characters to/from the files

Check for end of file by seeing if the return value from the fread() function is less than or equal to zero

Use the ^ (i.e., caret) for the XOR operator

Declare the key table array and the lookup table array as static global variables

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