RSA calculation c ^ d mod n

In the RSA encryption algorithm, how would I calculate c^d mod nwhen cand dare large numbers?

+3
source share
3 answers

GMP is a C / C ++ software library that does this for you: mpz_powm, mpz_powm_ui in the documentation. The method used (mostly) is explained in the wikipedia page , and you can try reading the GMP source code if you guess it ...

+3
source

Operation "powMod" can be reduced by a smaller step.

5 ^ 3 % 6 ((5 * 5) % 6) * 5 % 6, 5 ^ 4 % 6 (((5 * 5) % 6) * 5 % 6) * 5 % 6). , modulo , , , c ^ d % n, c d .

: http://en.wikipedia.org/wiki/Modular_exponentiation

0

: / , " " . Java java.lang.BigInteger, modPow().

" ", (, "32- ", , , 32- ), " " , ( 14).

0

Source: https://habr.com/ru/post/1795798/


All Articles