pub trait ModPowerOf2Square {
    type Output;

    // Required method
    fn mod_power_of_2_square(self, pow: u64) -> Self::Output;
}
Expand description

Squares a number modulo $2^k$. The input must be already reduced modulo $2^k$.

Required Associated Types§

Required Methods§

source

fn mod_power_of_2_square(self, pow: u64) -> Self::Output

Implementations on Foreign Types§

source§

impl ModPowerOf2Square for u8

source§

fn mod_power_of_2_square(self, pow: u64) -> u8

Squares a number modulo another number $2^k$. The input must be already reduced modulo $2^k$.

$f(x, k) = y$, where $x, y < 2^k$ and $x^2 \equiv y \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§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 ModPowerOf2Square for u16

source§

fn mod_power_of_2_square(self, pow: u64) -> u16

Squares a number modulo another number $2^k$. The input must be already reduced modulo $2^k$.

$f(x, k) = y$, where $x, y < 2^k$ and $x^2 \equiv y \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§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 ModPowerOf2Square for u32

source§

fn mod_power_of_2_square(self, pow: u64) -> u32

Squares a number modulo another number $2^k$. The input must be already reduced modulo $2^k$.

$f(x, k) = y$, where $x, y < 2^k$ and $x^2 \equiv y \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§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 ModPowerOf2Square for u64

source§

fn mod_power_of_2_square(self, pow: u64) -> u64

Squares a number modulo another number $2^k$. The input must be already reduced modulo $2^k$.

$f(x, k) = y$, where $x, y < 2^k$ and $x^2 \equiv y \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§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 ModPowerOf2Square for u128

source§

fn mod_power_of_2_square(self, pow: u64) -> u128

Squares a number modulo another number $2^k$. The input must be already reduced modulo $2^k$.

$f(x, k) = y$, where $x, y < 2^k$ and $x^2 \equiv y \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§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 ModPowerOf2Square for usize

source§

fn mod_power_of_2_square(self, pow: u64) -> usize

Squares a number modulo another number $2^k$. The input must be already reduced modulo $2^k$.

$f(x, k) = y$, where $x, y < 2^k$ and $x^2 \equiv y \mod 2^k$.

§Worst-case complexity

Constant time and additional memory.

§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 = usize

Implementors§