[][src]Trait zkp_u256::Montgomery

pub trait Montgomery: Zero {
    pub fn reduce_1_inline<M: MontgomeryParameters<UInt = Self>>(&self) -> Self;
pub fn redc_inline<M: MontgomeryParameters<UInt = Self>>(
        lo: &Self,
        hi: &Self
    ) -> Self;
pub fn square_redc_inline<M: MontgomeryParameters<UInt = Self>>(
        &self
    ) -> Self;
pub fn mul_redc_inline<M: MontgomeryParameters<UInt = Self>>(
        &self,
        rhs: &Self
    ) -> Self;
pub fn inv_redc<M: MontgomeryParameters<UInt = Self>>(&self) -> Option<Self>; pub fn to_montgomery<M: MontgomeryParameters<UInt = Self>>(&self) -> Self { ... }
pub fn from_montgomery<M: MontgomeryParameters<UInt = Self>>(&self) -> Self { ... }
pub fn reduce_1<M: MontgomeryParameters<UInt = Self>>(&self) -> Self { ... }
pub fn redc<M: MontgomeryParameters<UInt = Self>>(
        lo: &Self,
        hi: &Self
    ) -> Self { ... }
pub fn square_redc<M: MontgomeryParameters<UInt = Self>>(&self) -> Self { ... }
pub fn mul_redc<M: MontgomeryParameters<UInt = Self>>(
        &self,
        rhs: &Self
    ) -> Self { ... }
pub fn mul_mod<M: MontgomeryParameters<UInt = Self>>(
        &self,
        rhs: &Self
    ) -> Self { ... } }

Required methods

pub fn reduce_1_inline<M: MontgomeryParameters<UInt = Self>>(&self) -> Self[src]

Modular reduction at most once Note. Implementers must add the #[inline(always)] attribute

pub fn redc_inline<M: MontgomeryParameters<UInt = Self>>(
    lo: &Self,
    hi: &Self
) -> Self
[src]

Note. Implementers must add the #[inline(always)] attribute

pub fn square_redc_inline<M: MontgomeryParameters<UInt = Self>>(&self) -> Self[src]

Note. Implementers must add the #[inline(always)] attribute

pub fn mul_redc_inline<M: MontgomeryParameters<UInt = Self>>(
    &self,
    rhs: &Self
) -> Self
[src]

Note. Implementers must add the #[inline(always)] attribute

pub fn inv_redc<M: MontgomeryParameters<UInt = Self>>(&self) -> Option<Self>[src]

Loading content...

Provided methods

pub fn to_montgomery<M: MontgomeryParameters<UInt = Self>>(&self) -> Self[src]

pub fn from_montgomery<M: MontgomeryParameters<UInt = Self>>(&self) -> Self[src]

pub fn reduce_1<M: MontgomeryParameters<UInt = Self>>(&self) -> Self[src]

pub fn redc<M: MontgomeryParameters<UInt = Self>>(lo: &Self, hi: &Self) -> Self[src]

pub fn square_redc<M: MontgomeryParameters<UInt = Self>>(&self) -> Self[src]

pub fn mul_redc<M: MontgomeryParameters<UInt = Self>>(&self, rhs: &Self) -> Self[src]

pub fn mul_mod<M: MontgomeryParameters<UInt = Self>>(&self, rhs: &Self) -> Self[src]

Multiply two numbers in non-Montgomery form.

Combined to_montgomery, mul_redc, and from_montgomery.

Normally this would require four mul_redc operations, but two of them cancel out, making this an efficient way to do a single modular multiplication.

Requirements

Inputs are required to be reduced modulo M::MODULUS.

Loading content...

Implementors

impl Montgomery for U256[src]

Loading content...