```{index} single: powm_gmp; Math::GMP function ``` ```{index} single: Math::GMP::powm_gmp; Perl function ``` # powm_gmp Compute `$base ** $exp mod $mod` without building the full power. ## Synopsis ```perl my $base = Math::GMP->new(157); my $exp = Math::GMP->new(100); my $mod = Math::GMP->new(5013); my $r = $base->powm_gmp($exp, $mod); # 157**100 mod 5013 ``` The workhorse of RSA-style modular exponentiation: fast enough for thousand-bit exponents, and never materialises the intermediate `$base ** $exp`. Behaviour is undefined when `$mod` is `0`.