Your company, TradeSecrets, wants to encrypt their internal messages on the intranet to their partners. The program has to also be capable of decryption so that the recipient partner is able to provide the encryption key and read the original message.
Individual Assignment 2: Message Hiding
Due: start of class, week 8
Your company, TradeSecrets, wants to encrypt their internal messages on the
intranet to their partners. The program has to also be capable of decryption so that
the recipient partner is able to provide the encryption key and read the original
message.
Encryption is to be done via a numerical key provided by the user. Once a user
provides the key they want to be used for the encryption, your programs uses that
key to change every character of the message using some algorithm.
Decryption is to be done via the same numerical key. The recipient is assumed to
have been sent the key separately. The recipient will also use the same program to
indicate that they would like to decrypt a message. They will provide the original
message and the key, and the program will show them the original message as
intended.
The program will encode or decode the message by SHIFTING characters by the
amount indicated by the key (look at Appendix 7 for character with ASCII values of
32 through 126, also provided for you at the end of this document). For example:
•
If the key is 10, and the message is “hi~”
o
Encoding (because the key is subtracted to each character, shifting it
down the ASCII table):
�
The h moves down 10 to ^
�
The i moves down 10 to _
�
The ~ moves down 10 to t
o
Decoding (because the key is added to each character, shifting it down
the ASCII table):
�
The h moves up 10 to r
�
The i moves up 10 to s
�
The ~ moves up 10 to )
•
The encrypted message is printed if they are identified as an encoder, or the
original message is printed if they are identified as a decoder.
o
Using the example from above:
�
Encoding will print “^_t”
�
Decoding will print “rs)”
Note in this example that character shifting must wrap within the range. That is, if
you have a character with the value 33 in ASCII encoding, and you need to decode by
subtracting 10, you would “count” the character at 32 as a shift by 1 position, and
then shift a further 9 positions from the top end of the ASCII set (number 126), and
land at 118. The valid range of keys that user’s may provide in this program is set
from 10 to 200.
Requirements:
•
The user is prompted to enter whether they are an encoder or decoder. This
is recorded in the program.
•
The user is prompted for the encryption key (a whole number value). This
value is recorded in the program
•
The user is then prompted for the message to encode if they are identified as
an encoder, or prompted for the message that needs to be decoded if they are
identified as a decoder. The message is continuous text and the enter key is
only pressed after the user is done typing the entire message. (Once the user
hits “enter,” this marks the end of the message.)
•
The program will encode by SHIFTING characters using subtraction
o
Add the key value to each character’s ASCII value
•
The program will decode the message by SHIFTING characters using addition
o
Subtract the key value from each character’s ASCII value
•
If encoding or decoding crosses the “end” of the ASCII character range (32126),
the shifting should “wrap” from the other end of the range.
•
If the user is identified as encoder, the program prints the encoded message
•
If the user is identified as decoder, the program prints the decoded message
•
The program can take in any valid positive or negative integer value as the
key and use it in the program.
•
The program must validate to ensure the user provided a valid numeric value
for the key (between 10 and 200).
o
If not, the user should be prompted for a valid numeric value until one
is provided.
•
You may not use Arrays or other types or other classes that we have not used
in class.
•
The characters must stay between the printable characters identified in
Appendix 7 (32 – 126).
•
A message that is encoded using the program must also decode with the
original key and the encoded message.
Instructions:
•
First, develop the pseudocode for the logic you will need encode and decode.
Put this in a document that will submit with your code deliverable.
•
Then, develop a program following your pseudocode.
•
When you are finished, submit a zipped archive of your NetBeans project
(call the zipped file Assignment2_StudentName.zip) and a document showing
your pseudocode. Submit these two items to the Individual Assignment Two
dropbox on Blackboard before the start of class, week 8.
11 years ago
Purchase the answer to view it

- messagehiding.zip
- pesduocode.docx