Write a Java program called EncryptDecrypt that reads a String from the user called s and then prints out to the screen a new String called encrypteds that repiesents the encrypted version of s as per the encryption technique described above. Then your program should use encrypteds to recover the original message using the decryption technique explained above and store the decrypted message in a variable called decrypteds that should be printed out to the screen.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
4. Encryption is used to secure data messages in computer networks. One possible way of encrypting
text consists of rewriting the text by including first the characters found at even indexes (starting
from 0) followed by the characters stored at odd indexes, while ignoring whitespace characters.
For instance, the String "Exam is fun" can be encoded using the previously explained
technique as "Easfnxmiu". To be able to recover the original message based on the encrypted
version of the message, some additional information should be added to the encrypted message,
namely, the number of characters found at even indexes, the number of characters found at odd
indexes, and the indexes at which the white space characters existed in the original message. In
this way, reconsidering our previous example, the string "Exam is fun" can be encoded
using the previously explained technique as "5 4 4 7 Easfnxmiu". This is particularly true
since the original message had 5 characters at even indexes (i.e., Easfn), 4 characters at odd
indexes (i.e.., xmiu) and two spaces at indexes 4 and 7, respectively.
When reconstructing the original message based on "5 4 4 7 Easfnxmiu" in this example, a
new String is created, the portion containing the characters is extracted, and then characters are
taken from both sides of that portion (the even-index characters and odd-index characters) until the
index of a white space character is reached. The process is then repeated to reconstruct all of the
remaining words of the original message.
Write a Java program called EncryptDecrypt that reads a String from the user called S
and then prints out to the screen a new String called encrypteds that repiesents the
encrypted version of S as per the encryption technique described above. Then your program
should use encrypteds to recover the original message using the decryption technique
explained above and store the decrypted message in a variable called decrypteds that should
be printed out to the screen.
Transcribed Image Text:4. Encryption is used to secure data messages in computer networks. One possible way of encrypting text consists of rewriting the text by including first the characters found at even indexes (starting from 0) followed by the characters stored at odd indexes, while ignoring whitespace characters. For instance, the String "Exam is fun" can be encoded using the previously explained technique as "Easfnxmiu". To be able to recover the original message based on the encrypted version of the message, some additional information should be added to the encrypted message, namely, the number of characters found at even indexes, the number of characters found at odd indexes, and the indexes at which the white space characters existed in the original message. In this way, reconsidering our previous example, the string "Exam is fun" can be encoded using the previously explained technique as "5 4 4 7 Easfnxmiu". This is particularly true since the original message had 5 characters at even indexes (i.e., Easfn), 4 characters at odd indexes (i.e.., xmiu) and two spaces at indexes 4 and 7, respectively. When reconstructing the original message based on "5 4 4 7 Easfnxmiu" in this example, a new String is created, the portion containing the characters is extracted, and then characters are taken from both sides of that portion (the even-index characters and odd-index characters) until the index of a white space character is reached. The process is then repeated to reconstruct all of the remaining words of the original message. Write a Java program called EncryptDecrypt that reads a String from the user called S and then prints out to the screen a new String called encrypteds that repiesents the encrypted version of S as per the encryption technique described above. Then your program should use encrypteds to recover the original message using the decryption technique explained above and store the decrypted message in a variable called decrypteds that should be printed out to the screen.
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY