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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 18:00
Which of the following physical laws can make the flow of water seem more realistic? a. motion b. gravity c. fluid dynamics d. thermodynamics
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
For a typical middle-income family, what is the estimated cost of raising a child to the age of 18? $145,500 $245,340 $304,340 $455,500
Answers: 2
question
Computers and Technology, 23.06.2019 21:30
To move a file or folder in microsoft windows, you can click and hold down the left mouse button while moving your mouse pointer to the location you want the file or folder to be, which is also known as.
Answers: 3
question
Computers and Technology, 24.06.2019 03:00
Will do anything for brainlest so can you guys me out i will try my best to you out
Answers: 1
You know the right answer?
In cryptography, we use encryption ciphers to encode ("encrypt") a plaintext into a ciphertext. in t...
Questions
question
Mathematics, 03.10.2020 01:01
question
Geography, 03.10.2020 01:01
Questions on the website: 13722360