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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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.

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

Write an assembly program that print the odd numbers
from 1 to 49. Prints one number per line.

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Public key encryption
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education