PA5: Decrypting a secret message
PA5: Decrypting a secret message In this assignment, you’ll decrypt a secret message using a cipher. A “cipher” is a program that converts a message in normal text into a secret message, and viceversa. For example, the normal message “meet at five pm” might be converted to the secret message “[@@, !, (#<@ ][“ using a cipher. The secret message can be sent to a friend. Nobody else could read the message, expect the friend whose cipher would convert the secret message back to normal text. The starter program decrypts the first character in a secret message if that first character is ‘{‘. The complete list of cipher and normal characters to decrypt a message: ‘!’ > ‘a’ ‘^’ > ‘b’ ‘&’ > ‘c’ ‘*’ > ‘d’ ‘@’ > ‘e’ ‘(‘ > ‘f’ ‘)’ > ‘g’ ‘’ > ‘h’ ‘#’ > ‘i’ ‘_’ > ‘j’ ‘=’ > ‘k’ ‘+’ > ‘l’ ‘[‘ > ‘m’ ‘{‘ > ‘n’ ‘$’ > ‘o’ ‘]’ > ‘p’ ‘}’ > ‘q’ ‘;’ > ‘r’ ‘:’ > ‘s’ ‘,’ > ‘t’ ‘%’ > ‘u’ ‘<‘ > ‘v’ ‘.’ > ‘w’ ‘>’ > ‘x’ ‘/’ > ‘y’ ‘?’ > ‘z’ 1) Decrypt by hand the following secret message: {#&@ Then, modify the program to decrypt all instances of ‘{‘ in the secret message to ‘n’. 2) Modify the program to decrypt all instances of 3 more decryptions: ‘&’ > ‘c’ ‘@’ > ‘e’ ‘#’ > ‘i’ Your program should decrypt the following secret message: {#&@ 3) Add the remaining 22 decryptions. Instead of coding 22 more branch statements, loop through the cipherV vector. Refer to the “Multiple vectors” section for an example of a program with two vectors. Here is an example program execution (user input is highlighted here for clarity): Enterasecretmessage:{#&@ Decryptedmessage:nice Here is an example program execution (user input is highlighted here for clarity): Enterasecretmessage:[@@,!,(#<@][ Decryptedmessage:meetatfivepm Here is an example program execution (user input is highlighted here for clarity): Enterasecretmessage:Y$%-!<@${&@!)!#{($#+@*[/]+!{: Decryptedmessage:Youhaveonceagainfoiledmyplans
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"
