Question
PROGRAMMING IN C; PROPERLY - The code that was submitted to here had over 15 errors and couldnt compile whatsoever In this assignment youll write
PROGRAMMING IN C; PROPERLY - The code that was submitted to here had over 15 errors and couldnt compile whatsoever
In this assignment youll write a program that encrypts the alphabetic letters in a file using the Vignere cipher. Your program will take two command line parameters containing the names of the file storing the encryption key and the file to be encrypted. The program must generate output to the console (terminal) screen as specified below.
Programming Assignment 1 is defined in detail here
Please note there are 5 key files, respectively named k0.txt thru k4.txt. There are also 5 plaintext files named p0.txt thru p4.txt. And when you unpack the ZIP you'll also see the 5 base case outputs used to check your program's outputs. The base cases are the standard solution for the five respective key and plaintext files.
The test files and script are in the ZIP:pa1Files.zip Use the text at the very bottom of k2 and p2 as reference if you dont wanna use the drop box
https://www.dropbox.com/s/iwa3rv2e384hint/pa1Files.zip?dl=0
1 Vignere Cipher
In this assignment youll write a program that encrypts the alphabetic letters in a file using the Vignere cipher. Your program will take two command line parameters containing the names of the file storing the encryption key and the file to be encrypted. The program must generate output to the console (terminal) screen as specified below.
1.1 Command line parameters
Your program must compile and run from the command line.
Input the required file names as command line parameters. Your program may NOT prompt the user to enter the file names. The first parameter must be the name of the encryption key file, as described below. The second parameter must be the name of the file to be encrypted, as also described below. The sample run command near the end of this document contains an example of how the parameters will be entered.
Your program should open the two files, echo the processed input to the screen, make thenecessary calculations, and then output the ciphertext to the console (terminal) screen in the format described below.
Note
If the plaintext file to be encrypted doesnt have the proper number (512) of alphabetic characters, pad the last block as necessary with the lowercase letter x. Make sure that all the input characters are lower case only.
1.2 Formats
Encryption Key File Formats
The encryption key is plain text that may contain upper and lower case letters, numbers, and other text. The input must be stripped of all non-alphabetic characters. Please note that the input text must be converted to contiguous lower case letters to simplify the encryption process.
Encryption Plaintext File Formats
The file to be encrypted can be any valid text file with no more than 512 letters in it. (Thus, it is safe to store all characters in the file in a character array of size 512, including any pad characters.) Please note that the input text file will also generally have punctuation, numbers, special characters, and whitespace in it, which should be ignored. You should also ignore whether a letter is uppercase or lowercase in the input file. Thus, you should treat A and a the same in your program. In order to simplify the encryption, all letters should be converted to lower case letters. In the event the plaintext input file is lessthan512 characters, pad the input file with a lowercase x until the 512 character input buffer is full.
Output Format
The program must output the following to the console (terminal) screen, also known as stdout:
Echo the lowercase alphabetic text derived from the input key file.
Echo the lowercase alphabetic text derived from the input plaintext file.
Remember to pad with x if the processed plaintext is less than 512 characters.
Ciphertext output produced from encrypting the input key file against the input plaintextfile.
The output portion of each input file should consist of only lowercase letters in rows of exactly 80 letters per row, except for the last row, which may possibly have fewer. These characters should correspond to the ciphertext produced by encrypting all the letters in the input file. Please note that only the alphabetic letters in the input plaintext file will be encrypted. All other characters should be ignored.
1.3 Submission instructions
You must submit this assignment in Webcourses as a source file upload. Note that all submissions will be via Webcourses. The submitted programs will be tested and graded on
Eustis.
Make sure to include a comment at the top of your main source file that contains the following Academic Integrity statement (substitute your name and NID) - I[name] ([NID])affirmthat this program is entirely my own work and that I have neither developed my code together with any another person, nor copied any code from any other person, nor permitted my code to be copied or otherwise used by any other person, nor have I copied, modified, or otherwise used programs created by others. I acknowledge that any violation of the above terms will be treated as academic dishonesty.
1.4 Program Notes and Hints
Your program must read in an input plaintext file that may contain uppercase letters, lowercase letters and non-letter characters. Your program must distinguish between these three groups so that only the letters get encrypted. All non-letter characters in the file are simply skipped and not counted as part of the plaintext. Please note that although both upper case and lower case letters will be encrypted, your program should convert an upper case input letter to the corresponding lower case letter, i.e., it should convert an A to an a, and so on for the whole alphabet.
One possible breakdown to solve this problem is as follows:
Write a section of code or function that reads only the upper and lower case letters in theinput file into an char array of size 512, storing only the appropriate lowercase letters in the character array.
Write a section of code or function that takes as input the array from section 1 and theencryption key and produces an array of ciphertext storing only lowercase letters.
Write a section of code or function that takes as input the array storing the ciphertextand outputs it to the screen in the format specified. Additional functions or code will be needed to echo the input key and plaintext files.
1.5 Sample inputs and outputs
Sample Key File
I think and think for months and years. Ninety-nine times, the conclusion is false. The hundredth time I am right. - Albert Einstein Imagination is more important than knowledge. For knowledge is limited, whereas imagination embraces the entire world, stimulating progress, giving birth to evolution. - Albert Einstein[1]
Sample Plaintext File
Fall in love with some activity, and do it! Nobody ever figures out what life is all about, and it doesnt matter. Explore the world. Nearly everything is really interesting if you go into it deeply enough. Work as hard and as much as you want to on the things you like to do the best. Dont think about what you want to be, but what you want to do. Keep up some kind of a minimum with other things so that society doesnt stop you from doing anything at all. - Richard Feynman[2]
Sample Ciphertext Output File
ntstvxlbyxdqgrxcdqopmpnigbyrdugvbasumqgrzxzrmynyiuchvhbsbzvnwnsldptisbnnqumwwvxa zxuafkmxlqpwpvvmlmjgkplammrrgrvxzmgpazuzwzqpzcriamxyefdvbctjbuylczxgceehhkttqpva czlzkyorwhszpatlnsfcqueezfuyefmassampvxdwervqhcxcvemwquiyshvwlvuvobuoosruvnhacoe shcknneussxfcgoaeblwndiadtbghrmrzzdjaardpfdbiyqieazczabruwglxzflagnwucgjlnkwqvml ddzwwgawaicbfyikvflamvgmegzobnrbxrepzvuaezqnqytunnqflkfpjlobfjmloqxkqqexkhkltiba dbclohkltibadbfpifjfqbatebobxpfjxdfkxqflkbjyoxzbpqebbkqfobtloiapqfjrixqfkdmoldob ppdfsfkdyfoqeqlbslirqflkxiyboqbf
[1] This is k2.txt in the Programming Assignment 1 ZIP file.
[2] This is p2.txt in the Programming Assignment 1 ZIP file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started