Exercise 5. This program implements the RSA public key cryptography scheme. The user enters two primes \(p\) and \(q\), an \(r\) that is relatively prime to \(m = lcm(p -1,q -1)\), and the message \(M\) to be sent. Then the program computes the \(s\) which is the inverse of \(r\) mod \(m\), and the value of \(M^r\) mod \(pq\). Then the user can input those numbers and have the computer raise the numbers to the \(s\) power to obtain the original input.

Please enter \(p\), \(q\), \(r\) and the message \(M\) for encrypt the message.









Please enter \(pq\), \(s\) and \(M^r \;mod\;pq\) for decryping the message.