Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

Compose the six common types of social business messages.

Answered: 1 week ago

Question

Describe positive and neutral messages.

Answered: 1 week ago