Next: Integer Roots, Previous: Integer Division, Up: Integer Functions [Index]

- Function:
*void***mpz_powm***(mpz_t*`rop`, const mpz_t`base`, const mpz_t`exp`, const mpz_t`mod`) - Function:
*void***mpz_powm_ui***(mpz_t*`rop`, const mpz_t`base`, unsigned long int`exp`, const mpz_t`mod`) Set

`rop`to*(*.`base`raised to`exp`) modulo`mod`Negative

`exp`is supported if an inverseexists (see`base`^-1 mod`mod``mpz_invert`

in Number Theoretic Functions). If an inverse doesn’t exist then a divide by zero is raised.

- Function:
*void***mpz_powm_sec***(mpz_t*`rop`, const mpz_t`base`, const mpz_t`exp`, const mpz_t`mod`) Set

`rop`to*(*.`base`raised to`exp`) modulo`mod`It is required that

and that`exp`> 0`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.

- Function:
*void***mpz_pow_ui***(mpz_t*`rop`, const mpz_t`base`, unsigned long int`exp`) - Function:
*void***mpz_ui_pow_ui***(mpz_t*`rop`, unsigned long int`base`, unsigned long int`exp`) Set

`rop`to. The case`base`raised to`exp`*0^0*yields 1.