# Tag Info

## New answers tagged cr.crypto-security

2

Using Fermat theorem, $a^p -a = 0 (\mod p)$ and if a and p are co-prime, then $a^{p−1} − 1 =1(\mod p)$ So if u choose n to be a prime number(say p), then $a^{b^c} \mod p = a^{ (b^{c} \mod (p-1))} \mod p$ , Then you can use Fast Exponentiation trick in two levels, once for $b^c \mod p-1$ then for $a^{b^c} \mod p$ I also suggest you to look at cses ...

Top 50 recent answers are included