Question: New Write a program that encrypts its input by XORing it with a keystream. Find or write as good a random number generator as you
New Write a program that encrypts its input by XORing it with a keystream. Find or write
as good a random number generator as you can to generate the keystream. The program should act as a filter, taking plaintext on standard input and producing ciphertext on standard output (and vice versa). The program should take one parameter, the key that seeds the random number generator. Using Java

Program plan: Import the required java packages. Create a class XOR to encrypt the plaintext input with the key stream and produce a cipher text as the output. Generate random number for the keystream o In the main() function, get the input from the user and read it Using try...Catch block, encrypt the user input using the randomly generated keystream and print the cipher text Create an object random for SecureRandom class to generate a strong random number generator using SHA1 algorithm Using the toString(2) class, convert the plaintext string to binary Display the plaintext string in binary Using the toString(2) class, convert the keystream to binary Display the keystream string in binary Using the toString(2) class, convert the ciphertext string to binary Display the ciphertext string in binary Using convertBiglntegerToString(cipherText), convert the ciphertext from binary to string characters Display the ciphertext characters Using the object receivedMessage which has been created from the Biglnteger class to store the received message after the keystream is XORed with ciphertext Create an object receivedMessageString for the string class to convert the big integer to string and store it in the object o Define the function convertString ToBiglnteger() for Biglnteger class to convert the each character in the String to Biglnteger o Define the function convertBiglntegerToString) for String class to convert the each byte in the big integer into a character and then forms a string of characters
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
