Your country is at war and your enemies are using a secretcode to communicate wi
ID: 3619232 • Letter: Y
Question
Your country is at war and your enemies are using a secretcode to communicate with each other. You have managed to intercepta messsage that reads as follows: :mmZdxZmx]Zpgy The message is obviously encrypted using the enemy's secretcode. You have just learned that their encryption method is basedupon the ASCii code. Appendix 3 shows the ASCii character set.Individual characters in a string are encoded using this system.For example, the letter "A" is encoded using the number 65 and "B"is encoded using the number 66. Your enemy's secret code takes each letter of the message andencrypts it as follows: If(OrigialChar + Key > 126) then EncryptedChar = 32 + ((OriginalChar +Key) - 127) Else EncrptedChar = (OriginalChar Key) For example, if the enemy uses Key = 10 then the message "Hey"would be encrypted as: Character ASCii code -------------------------- H 72 e 101 y 121 Encryped H = (72 + 10) = 82 = R in ASCii Encrypted e = (101 + 10) = 111 = o in ASCii Encrypted y = 32 + ((121 + 10) - 127) = 36 = $ in ASCii Consequently, "Hey" would be transmetted as "Ro$" Write a program that decrypts the intercepted message. Youonly know that the key used is a number between 1 and 100. Yourprogram should try to decode the message using all possible keysbetween 1 and 100. When you try the valid key, the message willmake sense. For all other keys, the message will appear asgibberish. Your country is at war and your enemies are using a secretcode to communicate with each other. You have managed to intercepta messsage that reads as follows: :mmZdxZmx]Zpgy The message is obviously encrypted using the enemy's secretcode. You have just learned that their encryption method is basedupon the ASCii code. Appendix 3 shows the ASCii character set.Individual characters in a string are encoded using this system.For example, the letter "A" is encoded using the number 65 and "B"is encoded using the number 66. Your enemy's secret code takes each letter of the message andencrypts it as follows: If(OrigialChar + Key > 126) then EncryptedChar = 32 + ((OriginalChar +Key) - 127) Else EncrptedChar = (OriginalChar Key) For example, if the enemy uses Key = 10 then the message "Hey"would be encrypted as: Character ASCii code -------------------------- H 72 e 101 y 121 Encryped H = (72 + 10) = 82 = R in ASCii Encrypted e = (101 + 10) = 111 = o in ASCii Encrypted y = 32 + ((121 + 10) - 127) = 36 = $ in ASCii Consequently, "Hey" would be transmetted as "Ro$" Write a program that decrypts the intercepted message. Youonly know that the key used is a number between 1 and 100. Yourprogram should try to decode the message using all possible keysbetween 1 and 100. When you try the valid key, the message willmake sense. For all other keys, the message will appear asgibberish.Explanation / Answer
please rate - thanks #include using namespace std; int main() {char input[100]; char output[100]; int key,count; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.