Question: Purpose Random number generators play a very important role in cryptography as they help to generate random, or pseudo - random, numbers. The textbook presents
Purpose
Random number generators play a very important role in cryptography as they help to generate random, or pseudorandom, numbers. The textbook presents pseudorandom number generators on page Your objective is to implement a pseudorandom number generator and then analyze its output for randomness.
Instructions
The linear congruential generator works as follows:
si a si b mod m i
where a b and m are integer constants.
Ideally, we would like these generators to be unpredictable, meaning given n consecutive output bits of the stream, it is computationally infeasible to predict the next bit with a greater than chance of success.
To complete the assignment, do the following:
Use Python to implement the linear congruential generator, generating an output sequence of exactly N binary digits in length.
This sequence should be derived from a keystream as explained in the last parts of section on pages in the textbook. Essentially, you generate a number of keys and then string them together, in binary format, to generate your binary sequence of N digits. So a key stream such as si sisin that is N binary digits in length is generated.
You MUST use the book values for the seed, a b and m on page
Your key stream should ideally be fairly long so that you can provide statistically reasonable answers to questions and below. A keystream of exactly N digits is required in this assignment, with N
Note that there are many ways to convert decimal to binary in python; a simple method is to output each integer key as a binary string and then concatenate those strings together:
num ; # decimal integer number
numString binnum # int to binary string conversion
printnumString: # should print the binary string after stripping off the leading b
Save the output sequence to a file called yourlastnameoutput.txt
Report the number of s and s in this sequence. How do these numbers compare?
Consider the sequence How many times does this substring occur in your output sequence? How many times would you expect it to occur in a truly random output sequence?
Submission
Please submit your answers as a zip file. The following items should be included in the zip file:
Python source files for your code
The yourlastnameoutput.txt file
A text document that has your answerscomments to questions and
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
