By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,191 Members | 749 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,191 IT Pros & Developers. It's quick & easy.

help me to solve this problem

P: 12
Your country is at war and your enemies are using a secret code to communicate with each other. You have managed to intercept a message 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 upon the ASCII code. 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 and encrypts it as follows:

If (OriginalChar + Key > 126) then
EncryptedChar = (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 102



Encrypted H = (72+10) = 82 = R in ASCII
Encrypted e = (101+10) = 111 = o in ASCII
Encrypted y = ((121+10)-127) = 36 = $ in ASCII

Consequently, “Hey” would be transmitted as “Ro$”.

Write a program that decrypts the intercepts the message. You only know that the used is a number between 1 and 100. Your program should try to decode the message using all possible keys between 1 and 100. When you try the valid key, the message will make sense.
Mar 12 '07 #1
Share this Question
Share on Google+
4 Replies


Expert 100+
P: 1,510
what is your problem? have you designed the algorithm to decode the data?
post the code you have implemented so far
Mar 12 '07 #2

P: 12
what is your problem? have you designed the algorithm to decode the data?
post the code you have implemented so far
i don't know how to do it...
please help me..
i need the full program of the question.
Mar 12 '07 #3

P: 12
i don't know how to do it...
please help me..
i need the full program of the question.

can you sent the program to my email


thanx
Mar 12 '07 #4

Expert 100+
P: 1,510
Originally Posted by
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve. This question will now be closed and you will have to post a new question when you're ready.

MODERATOR
Mar 12 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.