subject

In cryptography, we use encryption ciphers to encode ("encrypt") a plaintext into a ciphertext. in theory the ciphertext is only readable by someone who knows how the plaintext was encrypted. if they have this information they can "decrypt" and recover the plaintext. there are some very simple ciphers, known as "substitution ciphers". they're so simple that they're not used any more because they are easy to but they are great for us because they are easy to program! first is the "rot13" cipher. rot13 rotates each letter 13 positions in the alphabet. so an a becomes an n, and an o becomes a b. (the rotation wraps). if the rot13 cipher is applied a second time, the original plantext is restored: n becomes a, b becomes o. obviously the rot13 cipher provides no security! it's really used in various places on the internet to hide joke punch-lines or spoilers. another cipher, the "caesar cipher", is a substitution cipher with a little more security. the cipher uses a dictionary where each plaintext letter has a corresponding ciphertext letter paired with it. for example we might say a is substituted with m, bis substituted with x, etc. to encrypt, each letter is replaced with its ciphertext letter. to decrypt, the reverse process takes place: each ciphertext letter is replaced with the plaintext letter. this cipher is not particularly strong. it is quite easy to guess the plaintext-ciphertext mappings by exploiting knowledge of letter frequency and word length. it is, however, harder to break than rot13 for this assignment, we will write a c++ program capable of doing 4 things: 1. perform a rot13 substitution 2. perform a caesar encryption given a dictionary 3. perform a caesar decryption given a dictionary 4. create a random caesar cipher dictionary the format for the caesar cipher dictionary is a file with 26 pairs of letters, one per letter of the alphabet, in alphabetical order. each pair has two letters: the plaintext letter and the ciphertext letter. the pairs are separated by whitespace. while the dictionary contains only lowercase letters, the mappings also apply for uppercase letters. note that the ciphertext letters must be unique; you cannot have two different plaintext letters that map to the same ciphertext letter. for all of the substitution operations, all upper and lower case letters on input should be substituted (or rotated as the case may be) before being output. all other characters are simply copied unchanged from input to output. the program takes several command line arguments. the first, which is required, tells the program what operation to perform: perform rot 13 substitution. generate a random caesar cipher dictionary encrypt using the caesar cipher decrypt using the caesar cipher if the first argument is missing, the program should print missing command, then stop. if the first argument is not one of the four listed above, print the first argument followed by a space and not a valid command, then stop. for -r, there is an optional second argument. if provided, it is the name of the file to read from. if it is not provided, the program should read from standard input. the output should be generated to the standard output. if a filename is provided but the file cannot open for any reason, the program should print the filename followed by a space and file could not be opened, then stop for-g, the dictionary should be printed to the standard output. you must ensure that each plaintext letter maps to a unique ciphertext letter. for both -e and -d there is a required second argument, which is the filename of the dictionary. if the second argument is missing, print the message no dictionary given, and stop. if the dictionary cannot open for any reason, the program should print the filename followed by a space and dictionary could not be opened, then stop. when reading the dictionary, you must ensure that each plaintext letter maps to a unique ciphertext letter. if you find a case where the dictionary is not in alphabetical order, you must print missing letter l, where l is the missing letter, and stop. both -e and -d support an optional third argument, which is the file to read from. if it is not provided, the program should read from standard input. the output should be generated to the standard output. if a filename is provided but the file cannot open for any reason, the program should print the filename followed by a space and file could not be opened, then stop. in all cases if there are too many command line arguments, your program should print too many arguments, then stop.

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:10, o10922025
Assume that to_the_power_of is a function that expects two int parameters and returns the value of the first parameter raised to the power of the second parameter. write a statement that calls to_the_power_of to compute the value of cube_side raised to the power of 3 and that associates this value with cube_volume.
Answers: 1
image
Computers and Technology, 22.06.2019 23:30, TheBurntToast
What is the digital revolution and how did it change society? what are the benefits of digital media?
Answers: 1
image
Computers and Technology, 23.06.2019 10:30, badpotterchris
How would you categorize the software that runs on mobile devices? break down these apps into at least three basic categories and give an example of each.
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, gamingisfun
Me ! evelyn is a manager in a retail unit. she wants to prepare a report on the projected profit for the next year. which function can she use? a. pmt b. round c. division d. what-if analysis
Answers: 2
You know the right answer?
In cryptography, we use encryption ciphers to encode ("encrypt") a plaintext into a ciphertext. in t...

Questions in other subjects:

Konu
German, 17.03.2021 23:40
Konu
Mathematics, 17.03.2021 23:40
Konu
Mathematics, 17.03.2021 23:40