Give me two primes: 101, 113, now 101*113= 11413. phi(11413) = 100*112 = 11200. Give me a number relatively prime to 11200. We will go with e=39, relatively prime to phi(n). So our public key is (n,e) = (11413,39). So a message M (0 < M < n=11413) is to be encoded. M=808. To send this, we need to compute M^e % n. 808^39 % 11413 At all steps, if e is odd, I multiply ans by M (and %n). M e ans 808 39 808 2323 19 5252 9393 9 5050 5959 4 5050 3838 2 5050 7474 1 909 39 = 32 + 4 + 2 + 1 808^32 * 808 ^4 * 808^2 * 808^1 Let's say the real answer is 909. When I receive the message 909, I need to be able to decrypt it back to the original message. So, I need the d value. I know that e is 39. The d-value should be such that (de)%phi(n) = 1. I know that phi(n) is 11200, but I'm the only one who knows this because I'm the only one who knows the factors of n. Since e is 39, what is d? 11200 0 39 287 1 7 5 -287 4 1 1436 3 1 -1723 1 3159 = d d = 3159 909 3159 909 % by 11413 4545 1579 11312 10908 789 5353 3939 394 5353 5454 197 808 3838 98 808 7474 49 1515 5454 24 1515 3838 12 1515 7474 6 1515 5454 3 11211 3838 1 808