Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

I'm looking for help in my C++ class. I have posted the assignment below and would appreciate any possible help. Thank you. Reminder: I am

I'm looking for help in my C++ class. I have posted the assignment below and would appreciate any possible help. Thank you. Reminder: I am a beginner coder. image text in transcribed

Your country is at war and your enemies are using a secret code to communicate. You have managed to intercept a message that reads as follows: , vtaNm a "d abp!! The message is 16 characters long. The message is encrypted using the enemy's secret code. You have just learned that the encryption algorithm is to take the original message, treat each group of 4 bytes like an integer, add a secret key to the integer, then copy the resulting number to the encrypted message treating it like four characters. THERE" and the secret key is the number 2, then the For example, if the original string is "HI algorithm would: Take the first four characters, which are the first four bytes, which are "HI T" If these four bytes are typecast to a 4 byte int (the size of an int on most machines) then it has the value 1411402056. Add the secret key of 2 to the value resulting in the value 1411402058 Typecast the 1411402058 back as a 4 character string, resulting in "JI T" (basically it just increases the leftmost character by 2 in the ASCIl code) The process is repeated for the next group of 4 characters, "HERE": These four bytes are typecast to a 4 byte int which is the value 1163019592 Add the secret key of 2 to the value resulting in the value 1163019594 .Typecast 1163019594 back as a 4 character string, resulting in "JERE" The entire encrypted string would be "JI TJERE In the case of , vtaNm a_"dabp! ! you have figured out that the secret key is a number between 1 and 500. Write a function that decrypts an encrypted message using a key that input as a parameter. From main, call the function with numbers between 1 and 500 for the key, printing out the resulting decrypted text each time. When you hit the correct key you will get a message that makes sense and have cracked the code! You should implement your function/program with pointers that uses typecasting to map back and forth between (char ) and (int " as appropriate. What is the secret key and the decrypted message

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions