Question: keygen ( lo , hi ) - Get a list of primes from the interval [ lo , hi ) - Sample two distinct random
keygenlo hi
Get a list of primes from the interval lo hi
Sample two distinct random primes p and q from that list
Set n and m to pq and p q respectively
Get a list primes from the interval m
Choose a random prime e from the list such that e does not divide m you will need a loop for this
Find a d in m such that ed mod m you will need a loop for this
Return the tuplen e d
encryptx n e
Implement the function E x xe mod n
decrypty n d
Implement the function Dy y d mod n
A tuple is like a list, but is immutable. You create a tuple by enclosing commaseparated values within matched parentheses, eg a If a is a
tuple, ai is the ith element in it
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
