Suppose the two primes in the RSA schema are p 13 and q 23
Solution
1) Given p = 13 and q = 23, so n = pq = 299
Now, r= Euler totient( n ) = (p-1)(q-1) = 264
Let e = 5, it should be valid as gcd( e, 264) = 1
Then d = e-1( mod 264 ) ( = should have been written as actually three -- instead of two )
we can find d to be, 53 and we can verify that 53*5 mod 264 is indeed 1
So, now we got d and e
Testing on 225: m = 225 ( our message )
Encrypted = (me)mod n = (225)5mod 299 = 49
Decrypted = (49)dmod n = (49)53mod 299 = 225 ( got the message back )
2) Given p = 23 and q = 29, so n = pq = 667
Now, r= Euler totient( n ) = (p-1)(q-1) = 616
Let e = 5, it should be valid as gcd( e, 616 ) = 1
Then d = e-1( mod 616 )
we can find d to be, 493 and we can verify that 493*5 mod 616 is indeed 1
So, now we got d and e
Testing on 225: m = 225 ( our message )
Encrypted = (me)mod n = (225)5mod 667 = 187
Decrypted = (187)dmod n = (187)493mod 667 = 225 ( got the message back )
