Next: Integer Roots, Previous: Integer Division, Up: Integer Functions [Index]
Set rop to (base raised to exp) modulo mod.
Negative exp is supported if the inverse base-1 mod
mod exists (see mpz_invert
in
Number Theoretic Functions). If an inverse doesn’t exist then a divide
by zero is raised.
Set rop to (base raised to exp) modulo mod.
It is required that exp > 0 and that mod is odd.
This function is designed to take the same time and have the same cache access patterns for any two same-size arguments, assuming that function arguments are placed at the same position and that the machine state is identical upon function entry. This function is intended for cryptographic purposes, where resilience to side-channel attacks is desired.
Set rop to base raised to exp. The case 0^0 yields 1.