Lab 11 (10/05/2023)
Problems for lab session:
Practicals
Part 1
1. Write a function getCoPrime(K,N) to find the first N co-prime numbers with respect to K.
- Use the Extended Euclidean Algorithm to find the prime number.
2. Write a function getPremRoot(num) to find the first primitive root (R) of the number num greater than 1.
Rmust satisfy the equation:R^(x) mod num = qx = {1, 2, 3, ...., (num-1)}- The
set of all possible q = Qmust represent the results after solving the equation of different values ofx.
Part 2
1. Key generation in RSA.
- Solved in six-steps
- Public key =
{e, n}- Private key =
{d, n}
2. Write a function encRSA(data, key) to encrypt numeric data using RSA algorithm.