Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your country is at war and your enemies are using a secret code tocommunicate with each other. You have managed to intercept amessage that reads

Your country is at war and your enemies are using a secret code tocommunicate with each other. You have managed to intercept amessage that reads as follows:
:mmZ\dxZmx]Zpgy
The message is obviously encrypted using the enemy's secret code.You have just learned that their encryption method is based uponthe ASCII code. Individual characters in a string are encoded usingthis system. For example, the letter "A" is encoded using thenumber 65 and "B" is encoded using the number 66, and so on (Googlefor the ASCII table for conversion.)
Your enemy's secret code takes each letter of the message andencrypts it as follows:
If (OriginalChar + Key >126) then
EncryptedChar =32+((OriginalChar + Key)-127)
Else
EncryptedChar =(OriginalChar + Key)
For example, if the enemy uses Key =10 then the message "Hey"would be encrypted as:
ASCII Conversion
H -->72
e -->101
y -->121
Encrypted 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 transmitted as "Ro$."
Write a program that decrypts the intercepted message. You onlyknow that the key used is a number between 1 and 100. Your programshould try to decode the message using all possible keys between 1and 100. When you try the valid key, the message will make sense.For all other keys, the message will appear as gibberish.
Can I get this program to be able to be ran in C++

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 5.0 Databases

Authors: Vidya Vrat Agarwal

2nd Edition

1430242604, 978-1430242604

More Books

Students also viewed these Databases questions

Question

Discuss whether we can control stereotyping.

Answered: 1 week ago

Question

What is the cerebrum?

Answered: 1 week ago