pub trait ModPowerOf2Pow<RHS = Self> {
type Output;
// Required method
fn mod_power_of_2_pow(self, exp: RHS, pow: u64) -> Self::Output;
}Expand description
Raises a number to a power modulo $2^k$. The base must be already reduced modulo $2^k$.
Required Associated Types§
Required Methods§
fn mod_power_of_2_pow(self, exp: RHS, pow: u64) -> Self::Output
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl ModPowerOf2Pow for u64
impl ModPowerOf2Pow for u64
Source§fn mod_power_of_2_pow(self, exp: u64, pow: u64) -> u64
fn mod_power_of_2_pow(self, exp: u64, pow: u64) -> u64
Raises a number to a power modulo another number $2^k$. The base must be already reduced modulo $2^k$.
$f(x, n, k) = y$, where $x, y < 2^k$ and $x^n \equiv y \mod 2^k$.
§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().
The square-and-multiply ladder performs one or two modular multiplications per
exponent bit.
§Panics
Panics if pow is greater than Self::WIDTH or if self is greater than or equal
to $2^k$.
§Examples
See here.
type Output = u64
Source§impl ModPowerOf2Pow<u64> for u8
impl ModPowerOf2Pow<u64> for u8
Source§fn mod_power_of_2_pow(self, exp: u64, pow: u64) -> u8
fn mod_power_of_2_pow(self, exp: u64, pow: u64) -> u8
Raises a number to a power modulo another number $2^k$. The base must be already reduced modulo $2^k$.
$f(x, n, k) = y$, where $x, y < 2^k$ and $x^n \equiv y \mod 2^k$.
§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().
The square-and-multiply ladder performs one or two modular multiplications per
exponent bit.
§Panics
Panics if pow is greater than Self::WIDTH or if self is greater than or equal
to $2^k$.
§Examples
See here.
type Output = u8
Source§impl ModPowerOf2Pow<u64> for u16
impl ModPowerOf2Pow<u64> for u16
Source§fn mod_power_of_2_pow(self, exp: u64, pow: u64) -> u16
fn mod_power_of_2_pow(self, exp: u64, pow: u64) -> u16
Raises a number to a power modulo another number $2^k$. The base must be already reduced modulo $2^k$.
$f(x, n, k) = y$, where $x, y < 2^k$ and $x^n \equiv y \mod 2^k$.
§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().
The square-and-multiply ladder performs one or two modular multiplications per
exponent bit.
§Panics
Panics if pow is greater than Self::WIDTH or if self is greater than or equal
to $2^k$.
§Examples
See here.
type Output = u16
Source§impl ModPowerOf2Pow<u64> for u32
impl ModPowerOf2Pow<u64> for u32
Source§fn mod_power_of_2_pow(self, exp: u64, pow: u64) -> u32
fn mod_power_of_2_pow(self, exp: u64, pow: u64) -> u32
Raises a number to a power modulo another number $2^k$. The base must be already reduced modulo $2^k$.
$f(x, n, k) = y$, where $x, y < 2^k$ and $x^n \equiv y \mod 2^k$.
§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().
The square-and-multiply ladder performs one or two modular multiplications per
exponent bit.
§Panics
Panics if pow is greater than Self::WIDTH or if self is greater than or equal
to $2^k$.
§Examples
See here.
type Output = u32
Source§impl ModPowerOf2Pow<u64> for u128
impl ModPowerOf2Pow<u64> for u128
Source§fn mod_power_of_2_pow(self, exp: u64, pow: u64) -> u128
fn mod_power_of_2_pow(self, exp: u64, pow: u64) -> u128
Raises a number to a power modulo another number $2^k$. The base must be already reduced modulo $2^k$.
$f(x, n, k) = y$, where $x, y < 2^k$ and $x^n \equiv y \mod 2^k$.
§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().
The square-and-multiply ladder performs one or two modular multiplications per
exponent bit.
§Panics
Panics if pow is greater than Self::WIDTH or if self is greater than or equal
to $2^k$.
§Examples
See here.
type Output = u128
Source§impl ModPowerOf2Pow<u64> for usize
impl ModPowerOf2Pow<u64> for usize
Source§fn mod_power_of_2_pow(self, exp: u64, pow: u64) -> usize
fn mod_power_of_2_pow(self, exp: u64, pow: u64) -> usize
Raises a number to a power modulo another number $2^k$. The base must be already reduced modulo $2^k$.
$f(x, n, k) = y$, where $x, y < 2^k$ and $x^n \equiv y \mod 2^k$.
§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().
The square-and-multiply ladder performs one or two modular multiplications per
exponent bit.
§Panics
Panics if pow is greater than Self::WIDTH or if self is greater than or equal
to $2^k$.
§Examples
See here.