diff --git a/rsa-c/rsa-c/rsa.c b/rsa-c/rsa-c/rsa.c index c2d62b46983a20549829ed456e1f8105906018b0..9d20f7977033d721dfd2e55bf9511608368de71e 100644 --- a/rsa-c/rsa-c/rsa.c +++ b/rsa-c/rsa-c/rsa.c @@ -19,9 +19,9 @@ int gcd(int a, int b) { /*function that searches for d using inverted modulo*/ -int inverse_Modulo(int e, int n) { +int inverse_Modulo(int e, int p_1_q_1) { int d = 1; - while ((e * d) % n != 1) + while ((e * d) % p_1_q_1 != 1) d++; return d; } @@ -29,12 +29,12 @@ int inverse_Modulo(int e, int n) { /* message encryption/decryption: modular exponentiation, calculating x^e mod n by repeatedly multiplying x and taking the result modulo n*/ -int mod_Exp(int x, int e, int p_1_q_1) { +int mod_Exp(int x, int e, int n) { int c = 1; int e_prim = 0; while (e_prim < e) { e_prim++; - c = (x * c) % p_1_q_1; + c = (x * c) % n; } return c; }