Question: The ` getPrime ` function imported above takes as input an integer ` N ` and as output returns a random ` N ` -
The getPrime function imported above takes as input an integer N and as output returns a random Nbit prime number. For example, written in binary is which is digits, so is a bit prime number. You can verify this by evaluating tobaseb and checking that the resulting list is length The frombaseb function goes in the opposite direction.
Choose a prime p using the getPrime function. See the next few instructions to help you decide how large the prime should be
Find a generator g for $mathbbZp$Hint Use the norder function that we imported from SymPy Call helpnorder to see how this function works. What order do we need to have a generator? You will have to do some guessingandchecking or better, use a for loop, calling break when you've found a generator but it shouldn't take many guesses before you find a generator.
Call naivedlogg p and time how long it takes using time at the top of the cell. We already know that no discrete logarithm exists in this case why so the point of this is just to see how long the naive discrete logarithm takes to run in the worstcase scenario.
We want a prime for which this naive discrete logarithm calculation takes seconds. If your prime takes an amount of time outside of this range, then change the values of p and g above until you find values for which it takes seconds.
Again using the getPrime function, find a prime p which is bits larger add don't multiply than the prime p you found above.
As above, find a generator g for $mathbbZp$
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
