Question: 2) Write code for the RSA algorithm. Assume p, q, and e are given to you. You need to implement the following functions: a) generate
2) Write code for the RSA algorithm. Assume p, q, and e are given to you. You need to implement the following functions: a) generate key: Given p, q, and e, compute the decryption exponent d. b) encrypt: Given n, e, and the plaintext m, compute the ciphertext c. c) decrypt: Given d and the ciphertext c, compute the plaintext m.
You can use the following functions without implementing them: i) extended gcd: Given a and b, return two integers x and y such that ax + by = gcd(a; b). ii) modular exp: Given a, b, and n, return ab mod n.
language c++
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
