pub trait ModPowPrecomputed<RHS = Self, M = Self>where
    Self: Sized,
{ type Output; type Data; fn precompute_mod_pow_data(m: &M) -> Self::Data; fn mod_pow_precomputed(self, exp: RHS, m: M, data: &Self::Data) -> Self::Output; }
Expand description

Raises a number to a power modulo another number $m$. Assumes the input is already reduced modulo $m$.

If multiple modular exponentiations with the same modulus are necessary, it can be quicker to precompute some piece of data and reuse it in the exponentiation calls. This trait provides a function for precomputing the data and a function for using it during exponentiation.

Required Associated Types§

Required Methods§

Precomputes some data to use for modular exponentiation.

Implementations on Foreign Types§

Precomputes data for modular exponentiation.

See mod_pow_precomputed and mod_pow_precomputed_assign.

Worst-case complexity

Constant time and additional memory.

Raises a number to a power modulo another number $m$. Assumes the input is already reduced modulo $m$.

Some precomputed data is provided; this speeds up computations involving several modular exponentiations with the same modulus. The precomputed data should be obtained using precompute_mod_pow_data.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is exp.significant_bits().

Examples

See here.

Precomputes data for modular exponentiation.

See mod_pow_precomputed and mod_pow_precomputed_assign.

Worst-case complexity

Constant time and additional memory.

Raises a number to a power modulo another number $m$. Assumes the input is already reduced modulo $m$.

Some precomputed data is provided; this speeds up computations involving several modular exponentiations with the same modulus. The precomputed data should be obtained using precompute_mod_pow_data.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is exp.significant_bits().

Examples

See here.

Precomputes data for modular exponentiation.

See mod_pow_precomputed and mod_pow_precomputed_assign.

Worst-case complexity

Constant time and additional memory.

Raises a number to a power modulo another number $m$. Assumes the input is already reduced modulo $m$.

Some precomputed data is provided; this speeds up computations involving several modular exponentiations with the same modulus. The precomputed data should be obtained using precompute_mod_pow_data.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is exp.significant_bits().

Examples

See here.

Precomputes data for modular exponentiation.

See mod_pow_precomputed and mod_pow_precomputed_assign.

Worst-case complexity

Constant time and additional memory.

Raises a number to a power modulo another number $m$. Assumes the input is already reduced modulo $m$.

Some precomputed data is provided; this speeds up computations involving several modular exponentiations with the same modulus. The precomputed data should be obtained using precompute_mod_pow_data.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is exp.significant_bits().

Examples

See here.

Precomputes data for modular exponentiation.

See mod_pow_precomputed and mod_pow_precomputed_assign.

Worst-case complexity

Constant time and additional memory.

Raises a number to a power modulo another number $m$. Assumes the input is already reduced modulo $m$.

Some precomputed data is provided; this speeds up computations involving several modular exponentiations with the same modulus. The precomputed data should be obtained using precompute_mod_pow_data.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is exp.significant_bits().

Examples

See here.

Precomputes data for modular exponentiation.

See mod_pow_precomputed and mod_pow_precomputed_assign.

Worst-case complexity

Constant time and additional memory.

Raises a number to a power modulo another number $m$. Assumes the input is already reduced modulo $m$.

Some precomputed data is provided; this speeds up computations involving several modular exponentiations with the same modulus. The precomputed data should be obtained using precompute_mod_pow_data.

Worst-case complexity

$T(n) = O(n)$

$M(n) = O(1)$

where $T$ is time, $M$ is additional memory, and $n$ is exp.significant_bits().

Examples

See here.

Implementors§