pub fn pow_mod(base: &BigUint, exp: &BigUint, modulus: &BigUint) -> BigUintExpand description
Computes the modular exponentiation of a BigUint base raised to a BigUint exponent modulo another BigUint.
This function calculates (base ^ exp) % modulus using an efficient binary exponentiation algorithm,
which is useful for large numbers in cryptographic applications.
§Arguments
base- A reference to aBigUintrepresenting the base.exp- A reference to aBigUintrepresenting the exponent.modulus- A reference to aBigUintrepresenting the modulus.
§Returns
The result of (base ^ exp) % modulus.
§Examples
use num_bigint::BigUint;
use large_primes::pow_mod;
let base = BigUint::from(4u32);
let exponent = BigUint::from(13u32);
let modulus = BigUint::from(497u32);
let result = pow_mod(&base, &exponent, &modulus);
assert_eq!(result, BigUint::from(445u32));