Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a full program that comppiles and runs according to the instructions and also the files INSTRUCTIONS OVERVIEW According to Wikipedia In cryptography, a

Please write a full program that comppiles and runs according to the instructions and also the files

INSTRUCTIONS

OVERVIEW

According to Wikipedia "In cryptography, a substitution cipher is a method of encoding by which units of plaintext are replaced with ciphertext, according to a fixed system; the "units" may be single letters (the most common), pairs of letters, triplets of letters, mixtures of the above, and so forth."

For this lab you will write a C program that will be able to encrypt text files with a substitution cipher or decrypt text files that have previously been encrypted with a substitution cipher.

EXECUTION

The user of this program should be able to execute the program from the command line and should be able to provide all of the information the program needs in the form and command line arguments and files. The basic form of the command the user should be able to execute is:

program_name

In this command:

program_name is the name of your executable program

cipher_file is a text file containing the substitution cipher

clear_text_input_file.txt is a file containing unencrypted text

crypt_text_input_file.txt is a file containing encrypted text

clear_text_output_file.txt is a file used to store clear text after it's been decrypted

crypt_text_output_file.txt is a file used to store crypt text after it's been encrypted

Examples of some commands:

a cipher.txt encrypt clear_text.txt crypt_text.txt

This command would run the program called 'a' using the cipher contained in the file cipher.txt to encrypt the content of the file called clear_text.txt and would store the encrypted output into crypt_text.txt

./a.out cipher.txt decrypt crypt_text.txt clear_text.txt

This command would run the program called 'a' using the cipher contained in the file cipher.txt to decrypt the content of the file called crypt_text.txt and would store the decrypted output into clear_text.txt

THE CIPHER

The cipher itself will be stored in a file where every letter of the alphabet is matched with a 'converted' letter it matches up with. If in your substitution cipher the letter A was changed into the letter X then the line:

A X

would appear in the cipher file with a space separating the two letters (space delimited). An example of a cipher file is attached at the bottom of the assignment.

EXAMPLE SUBSTITUTION

If the sample command above was executed:

a cipher.txt encrypt clear_text.txt crypt_text.txt

and the clear_text.txt file contained:

THIS IS A SAMPLE FILE THAT HAS SOME SAMPLE TEXT IN IT. THIS IS SOME EXTRA

Then after the command was run the file called crypt_text.txt would contain:

URFK FK Q KQYBAO SFAO URQU RQK KXYO KQYBAO UOGU FL FU. URFK FK KXYO OGUMQ

ERRORS

The program should gracefully handle the following issues:

wrong number of command line arguments given

incorrectly formed cipher file

missing instruction to encrypt or decrypt

input file can not be opened

REQUIREMENTS

Program can correctly encrypt a clear text file 30 pts
Program can correctly decrypt a crypt text file 30 pts
Program uses a cipher from file 20 pts
Program handles specified errors 20 pts
Total 100 pts

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

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

Who chairs the ICWG?

Answered: 1 week ago