pub trait ModularOps<Rhs = Self, Modulus = Self>: ModularCoreOps<Rhs, Modulus> {
    fn powm(self, exp: Rhs, m: Modulus) -> Self::Output;
fn invm(self, m: Modulus) -> Option<Self::Output>
    where
        Self: Sized
;
fn jacobi(self, n: Modulus) -> i8;
fn kronecker(self, n: Modulus) -> i8; }
Expand description

This trait describes modular arithmetic operations

Required methods

Return (self ^ exp) % m

Calculate modular inverse (x such that self*x = 1 mod m).

This operation is only available for integer that is coprime to m

Calculate Jacobi Symbol (a|n), where a is self

Note that we don’t provide Legendre symbol function here, as it depends on primality test. However, if n is surely a prime, this function can be directly used as Legendre symbol.

Panics

if n is negative or even

Calculate Kronecker Symbol (a|n), where a is self

Implementations on Foreign Types

Implementors