RSA

p, q - prime number 
n = p*q - modulo 
(e, n) - public parameters of cryptosystem 
(d, n) or (d, p,q) - private parameters of cryptosystem 

m - message 
m^e = c (mod n) - cipher text 
m^(e*d) = m  (mod n)

So, your task to find d parameter having p,q,e numbers. 
I'm guarantee that the number e is valid. 

Input: p q e 
Output: d

IN

5
7
5

OUT

5

IN

5
7
7

OUT

7

IN

7
11
7

OUT

43

IN

11
17
3

OUT

107

IN

11
17
9

OUT

89

IN

11
17
89

OUT

9

I think, that this task must have test with big numbers. I think to add this test or not.

Sun Feb 22 15:51:46 2015


Leave a comment

Parsed as Markdown

Login to leave a comment