num-bigint
num-bigint copied to clipboard
Possible Incompleteness
In num-bigint/src/bigint.rs and num-bigint/src/biguint.rs, I think the code should check modulus != 0 and exponent >= 0/modulus != 0 as comments mentioned before use them to avoid possible panic. num-bigint/src/bigint.rs
/// Panics if the exponent is negative or the modulus is zero.
pub fn modpow(&self, exponent: &Self, modulus: &Self) -> Self {
power::modpow(self, exponent, modulus)
}
num-bigint/src/biguint.rs
/// Panics if the modulus is zero.
pub fn modpow(&self, exponent: &Self, modulus: &Self) -> Self {
power::modpow(self, exponent, modulus)
}