Skip to main content

mod_inverse

Function mod_inverse 

Source
pub fn mod_inverse(value: i64, modulus: i64) -> Option<i64>
Expand description

Computes the multiplicative inverse of value modulo modulus.

Returns Some(inverse) only when the inverse exists. The returned residue is normalized to 0..modulus. Returns None when modulus <= 0 or when value and modulus are not coprime.