Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Needed help on this one, thankss!! In this assignment you'll write a program that encrypts the alphabetic letters in a file using the Vigenre cipher.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedNeeded help on this one, thankss!!

In this assignment you'll write a program that encrypts the alphabetic letters in a file using the Vigenre 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. 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 the necessary calculations, and then output the ciphertext to the console (terminal) screen in the format described below. Note: If the plaintext file to be encrypted doesn't have the proper number (512) of alphabetic characters, pad the last block as necessary with the letter 'X'. Make sure that all the input characters are lower case only. Encryption keelammat 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 test must be r ted to contiguous lower case letters to simplify the encryption proces Ermitate File the End The file to be encrypted can be any valid text file with no more than 512 letters in it. Thus, it's safe to store all characters in the file in a character array of size 512, including any padding 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' and 'a'the same in your program. In order to simply the encryption, all letters should be converted to lower case letters. In the event the plaintext input file is less than 512 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 1. 2. Echo the unmodified input key file Echo the unmodified input plaintext file Ciphertext output produced from running the cipher against the input plaintext file. The ciphertext output portion 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 gered. What to Turn. In over Web Courses You must submit this assignment in Webcourses as a source file upload. Note that all grading will be performed on Webcourses submitted code that will be run and tested on Eustis PER Nates 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 se that only the letters get encrypted. All mon letter characters in the file are simply skipped and mot 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, le should convert an 'A' to an'a 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 the input 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 the encryption 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 ciphertext and outputs it to the screen in the format specified. Additional functions or code will be needed to che the input key and plaintext files Sample Key Files this and think for months and yes. Sinety-nine time, the conclusion i tale. The hundredth time i t.- Albert Einstein ination more important than knowledge. Her knowledge is limited, where inagination b e the entire word ating progress, giving birth to avolution. Albert Einstein Sample Plaintextile Tall in love with an activity and des Nobody aver t e but what it is all about, and it doean't matter. Explore the world. Nearly everything is really interesting if you go into it deeply enough. Not a hard and a w h you want to on the things you like to do the best. Don't think about what you want to be, but what you want to do. Keep up some kind of minimum with other things that melty don't stop you from doing anything at all." - Richard Teyman Corresponding Encrypted Output File by deppighedugtamagazyniuch aidt plastplag e r mye avbethuyetva Ekspansequatuyamamaghegy c s autogobindiadhghadapi buixtlantik styl gegab a ytlob mithi kitapitatabahagikholatlaispetto del pody k tyhoght Sample Run Command COEC program: prompt> ./.out kaya.txt plaintext.txt Java program: prompt> java vigenere keyl.txt plaintext.txt Grading Rubric The total possible score for this program is 100 points. The following point values will be deducted for the reasons stated: [-100 points Your program does not successfully compile from the command line with one of these commands: C program: prompt> Ce program prompt> Java programi prompt> goc - Vignere vigenerer 8++ - Vigenere vigenere.cpp avac vigenere.java Note: If you are submitting a Java program, the class file must be named "vigenere java and the class name must be vigenere |-100 point) The program does not accept input file names from the command line 1-90 points) Your program does not run from the command line without error or produces no output. 1-70 points ] The program compiles, runs, and outputs the key matrix and input file, but crashes thereafter or produces no encryption output. [-50 points) The program compiles, runs, echoes the inputs, and generates encryption output, but the encryption output is incorrect ignoring case) and it is not formatted correctly (not all letters or not all lowercase or not so characters per line) [-25 points) The program compiles, runs, echoes the inputs, generates encryption output, and the encryption output is correct ignoring case), but it is formatted incorrectly (not all letters or not all lowercase or not 80 letters per line) [-25 points) The program compiles, runs, echoes the inputs, and generates encryption output hut the encryption output is incorrect ignoring case) although it is formatted correctly (all lowercase letters, 80 letters per line) ( no deductions The program compiles, runs echoes the inputs, generates encryption output, the encryption output is correct ignoring case) and it is formatted correctly (all lowercase letters, 80 letters per line) Sample inputs arts There are three commands and their resultant output shown below. They are: cat plot . aut.tpl.it These commands and their output are described below. A couple of things to note, this is the text output from a session on Eustis and the prompt begins with the login NID followed by the terminal ID and the current working directory. Each of the cases below are in the same working directory in the SHOME directory, indicated by the character. WIDE D : hwis est al.txt cataloga the Firat kay Elle) bbbbbb bbbbbbbbb WIDEO :/hui cat pl.tut fataloge the first plaintext file) If you find that youre spending to you on theory. Start tuning some attention to practical things it will improve your theles. 1 you find that you're spending almost all your time on practice, start burning some attention to theoretical things it will improve your practice." - Donald Knuth NID ter /hw 1$ ./ out ki.txt pl.txt (anerypts the key plaintext Eldea Vigenere Key: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb Plaintext If you find that you spending antallyoutineontheyatartturningsmattentiontope actical thingsitwillimprove your theories you findthat you respondingalastall your tim compracticatartturningamattentiontothentialthings will proveyourpatice XXXXXXXXXXXXXXXXXDEEDEDEEDEEDERIKSRRRRR clpha aguibusvaftatooptube. powt oonfufus baju joj pafajspeibusafont pogadujtuajtbufojpopuifpafujitje poloviyyYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY en lei 3360/h / 2018 Each of the four key plaintext files are included in the ZIP file for this assignment. ALSO note that the test file hwlTest.sh runs all four plaintext and key files thru your vigenere code. It can be invoked using the command./hw1Test.sh vigenere.cpp. (The filename's extension should match the source code, that is.cfo Ccpp for C++, and.java for Java.) In this assignment you'll write a program that encrypts the alphabetic letters in a file using the Vigenre 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. 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 the necessary calculations, and then output the ciphertext to the console (terminal) screen in the format described below. Note: If the plaintext file to be encrypted doesn't have the proper number (512) of alphabetic characters, pad the last block as necessary with the letter 'X'. Make sure that all the input characters are lower case only. Encryption keelammat 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 test must be r ted to contiguous lower case letters to simplify the encryption proces Ermitate File the End The file to be encrypted can be any valid text file with no more than 512 letters in it. Thus, it's safe to store all characters in the file in a character array of size 512, including any padding 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' and 'a'the same in your program. In order to simply the encryption, all letters should be converted to lower case letters. In the event the plaintext input file is less than 512 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 1. 2. Echo the unmodified input key file Echo the unmodified input plaintext file Ciphertext output produced from running the cipher against the input plaintext file. The ciphertext output portion 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 gered. What to Turn. In over Web Courses You must submit this assignment in Webcourses as a source file upload. Note that all grading will be performed on Webcourses submitted code that will be run and tested on Eustis PER Nates 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 se that only the letters get encrypted. All mon letter characters in the file are simply skipped and mot 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, le should convert an 'A' to an'a 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 the input 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 the encryption 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 ciphertext and outputs it to the screen in the format specified. Additional functions or code will be needed to che the input key and plaintext files Sample Key Files this and think for months and yes. Sinety-nine time, the conclusion i tale. The hundredth time i t.- Albert Einstein ination more important than knowledge. Her knowledge is limited, where inagination b e the entire word ating progress, giving birth to avolution. Albert Einstein Sample Plaintextile Tall in love with an activity and des Nobody aver t e but what it is all about, and it doean't matter. Explore the world. Nearly everything is really interesting if you go into it deeply enough. Not a hard and a w h you want to on the things you like to do the best. Don't think about what you want to be, but what you want to do. Keep up some kind of minimum with other things that melty don't stop you from doing anything at all." - Richard Teyman Corresponding Encrypted Output File by deppighedugtamagazyniuch aidt plastplag e r mye avbethuyetva Ekspansequatuyamamaghegy c s autogobindiadhghadapi buixtlantik styl gegab a ytlob mithi kitapitatabahagikholatlaispetto del pody k tyhoght Sample Run Command COEC program: prompt> ./.out kaya.txt plaintext.txt Java program: prompt> java vigenere keyl.txt plaintext.txt Grading Rubric The total possible score for this program is 100 points. The following point values will be deducted for the reasons stated: [-100 points Your program does not successfully compile from the command line with one of these commands: C program: prompt> Ce program prompt> Java programi prompt> goc - Vignere vigenerer 8++ - Vigenere vigenere.cpp avac vigenere.java Note: If you are submitting a Java program, the class file must be named "vigenere java and the class name must be vigenere |-100 point) The program does not accept input file names from the command line 1-90 points) Your program does not run from the command line without error or produces no output. 1-70 points ] The program compiles, runs, and outputs the key matrix and input file, but crashes thereafter or produces no encryption output. [-50 points) The program compiles, runs, echoes the inputs, and generates encryption output, but the encryption output is incorrect ignoring case) and it is not formatted correctly (not all letters or not all lowercase or not so characters per line) [-25 points) The program compiles, runs, echoes the inputs, generates encryption output, and the encryption output is correct ignoring case), but it is formatted incorrectly (not all letters or not all lowercase or not 80 letters per line) [-25 points) The program compiles, runs, echoes the inputs, and generates encryption output hut the encryption output is incorrect ignoring case) although it is formatted correctly (all lowercase letters, 80 letters per line) ( no deductions The program compiles, runs echoes the inputs, generates encryption output, the encryption output is correct ignoring case) and it is formatted correctly (all lowercase letters, 80 letters per line) Sample inputs arts There are three commands and their resultant output shown below. They are: cat plot . aut.tpl.it These commands and their output are described below. A couple of things to note, this is the text output from a session on Eustis and the prompt begins with the login NID followed by the terminal ID and the current working directory. Each of the cases below are in the same working directory in the SHOME directory, indicated by the character. WIDE D : hwis est al.txt cataloga the Firat kay Elle) bbbbbb bbbbbbbbb WIDEO :/hui cat pl.tut fataloge the first plaintext file) If you find that youre spending to you on theory. Start tuning some attention to practical things it will improve your theles. 1 you find that you're spending almost all your time on practice, start burning some attention to theoretical things it will improve your practice." - Donald Knuth NID ter /hw 1$ ./ out ki.txt pl.txt (anerypts the key plaintext Eldea Vigenere Key: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb Plaintext If you find that you spending antallyoutineontheyatartturningsmattentiontope actical thingsitwillimprove your theories you findthat you respondingalastall your tim compracticatartturningamattentiontothentialthings will proveyourpatice XXXXXXXXXXXXXXXXXDEEDEDEEDEEDERIKSRRRRR clpha aguibusvaftatooptube. powt oonfufus baju joj pafajspeibusafont pogadujtuajtbufojpopuifpafujitje poloviyyYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY en lei 3360/h / 2018 Each of the four key plaintext files are included in the ZIP file for this assignment. ALSO note that the test file hwlTest.sh runs all four plaintext and key files thru your vigenere code. It can be invoked using the command./hw1Test.sh vigenere.cpp. (The filename's extension should match the source code, that is.cfo Ccpp for C++, and.java for Java.)

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

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions

Question

1. Does your voice project confidence? Authority?

Answered: 1 week ago