Question: Vigenere Encryption Language of code can be either C, CPP, or Java , please show the gcc command example of the program running if possible.

Vigenere Encryption

Language of code can be either C, CPP, or Java , please show the gcc command example of the program running if possible.

Included Files: Please create files that match the k1.txt and p1.txt as sample i/o

k1.txt: Sample Key File

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

p1.txt: Sample Plaintext file

"If you find that you're spending almost all your time on theory, start turning some attention to practical things; it will improve your theories. If you find that you're spending almost all your time on practice, start turning some attention to theoretical things; it will improve your practice." - Donald Knuth

Sample Output:

Vigenere Key:

bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb

Plaintext:

ifyoufindthatyourespendingalmostallyourtimeontheorystartturningsomeattentiontop

racticalthingsitwillimproveyourtheoriesifyoufindthatyourespendingalmostallyourti

meonpracticestartturningsomeattentiontotheoreticalthingsitwillimproveyourpractic

edonaldknuthxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Ciphertext:

jgzpvgjoeuibuzpvsftqfoejohbmnptubmmzpvsujnfpouifpsztubsuuvsojohtpnfbuufoujpoupqs

bdujdbmuijohtjuxjmmjnqspwfzpvsuifpsjftjgzpvgjoeuibuzpvsftqfoejohbmnptubmmzpvsujn

fpoqsbdujdftubsuuvsojohtpnfbuufoujpoupuifpsfujdbmuijohtjuxjmmjnqspwfzpvsqsbdujdf

epobmelovuiyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

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

1. Your program must compile and run from the command line.

2. 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.

3. 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

1.2.1 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.

1.2.2 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.

1.2.3 Output Format

The program must output the following to the console (terminal) screen, also known as stdout:

1. Echo the lowercase alphabetic text derived from the input key file.

2. 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.

3. 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:

1. 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.

2. 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.

3. 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

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!