Question: keygen ( lo , hi ) - Get a list of primes from the interval [ lo , hi ) - Sample two distinct random

keygen(lo, 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 1)(q 1), respectively
- Get a list primes from the interval [2, 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 [1, m) such that ed mod m =1(you will need a loop for this)
- Return the tuple1(n, e, d)
encrypt(x, n, e)
- Implement the function E (x)= xe mod n
decrypt(y, n, d)
- Implement the function D(y )= y d mod n
1 A tuple is like a list, but is immutable. You create a tuple by enclosing comma-separated values within matched parentheses, eg, a =(1,2,3). If a is a
tuple, a[i] is the ith element in it

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!