Question: In this problem, you'll implement a simplified version of a stream cipher. Remember that a stream cipher encrypts plaintext by combining it with a keystream
In this problem, you'll implement a simplified version of a stream cipher. Remember that a stream cipher encrypts plaintext by combining it with a keystream a pseudorandom sequence of bits to produce the ciphertext. The encryption and decryption processes are identical, except for the input data.
Things to do:
Keystream Generation:
Write a function generatekeystreamlength that generates a list of random integers between and inclusive to match the ASCII range.
Make sure the keystream is the same length as the plaintext.
Encrypt Function:
Implement an encrypt function that takes plaintext and keystream as inputs.
Convert each character of the plaintext to its ASCII integer value and then XOR with the keystream to produce each character of the ciphertext.
Decrypt Function:
Implement a decrypt function that uses the ciphertext and the same keystream to retrieve the original plaintext.
Since XOR encryption is symmetric, applying XOR with the same keystream to the ciphertext will recover the plaintext.
Test the Program:
Test your program with some test cases and mention them in the abovementioned document.
You must demonstrate both the encryption and decryption output to receive full marks.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
