Struct ConstMontyFormInverter

Source
pub struct ConstMontyFormInverter<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize>
where Odd<Uint<LIMBS>>: PrecomputeInverter<Output = Uint<LIMBS>>,
{ /* private fields */ }
Expand description

Bernstein-Yang inverter which inverts ConstMontyForm types.

Implementations§

Source§

impl<MOD: ConstMontyParams<SAT_LIMBS>, const SAT_LIMBS: usize, const UNSAT_LIMBS: usize> ConstMontyFormInverter<MOD, SAT_LIMBS>
where Odd<Uint<SAT_LIMBS>>: PrecomputeInverter<Inverter = SafeGcdInverter<SAT_LIMBS, UNSAT_LIMBS>, Output = Uint<SAT_LIMBS>>,

Source

pub const fn new() -> Self

Create a new ConstMontyFormInverter for the given ConstMontyParams.

Source

pub const fn inv( &self, value: &ConstMontyForm<MOD, SAT_LIMBS>, ) -> ConstCtOption<ConstMontyForm<MOD, SAT_LIMBS>>

Returns either the adjusted modular multiplicative inverse for the argument or None depending on invertibility of the argument, i.e. its coprimality with the modulus.

Source

pub const fn inv_vartime( &self, value: &ConstMontyForm<MOD, SAT_LIMBS>, ) -> ConstCtOption<ConstMontyForm<MOD, SAT_LIMBS>>

Returns either the adjusted modular multiplicative inverse for the argument or None depending on invertibility of the argument, i.e. its coprimality with the modulus.

This version is variable-time with respect to the value of self, but constant-time with respect to MOD.

Trait Implementations§

Source§

impl<MOD: ConstMontyParams<SAT_LIMBS>, const SAT_LIMBS: usize, const UNSAT_LIMBS: usize> Debug for ConstMontyFormInverter<MOD, SAT_LIMBS>
where Odd<Uint<SAT_LIMBS>>: PrecomputeInverter<Inverter = SafeGcdInverter<SAT_LIMBS, UNSAT_LIMBS>, Output = Uint<SAT_LIMBS>>,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<MOD: ConstMontyParams<SAT_LIMBS>, const SAT_LIMBS: usize, const UNSAT_LIMBS: usize> Inverter for ConstMontyFormInverter<MOD, SAT_LIMBS>
where Odd<Uint<SAT_LIMBS>>: PrecomputeInverter<Inverter = SafeGcdInverter<SAT_LIMBS, UNSAT_LIMBS>, Output = Uint<SAT_LIMBS>>,

Source§

type Output = ConstMontyForm<MOD, SAT_LIMBS>

Output of an inversion.
Source§

fn invert( &self, value: &ConstMontyForm<MOD, SAT_LIMBS>, ) -> CtOption<Self::Output>

Compute a modular inversion, returning None if the result is undefined (i.e. if value is zero or isn’t prime relative to the modulus).
Source§

fn invert_vartime( &self, value: &ConstMontyForm<MOD, SAT_LIMBS>, ) -> CtOption<Self::Output>

Compute a modular inversion, returning None if the result is undefined (i.e. if value is zero or isn’t prime relative to the modulus). Read more

Auto Trait Implementations§

§

impl<MOD, const LIMBS: usize> !Freeze for ConstMontyFormInverter<MOD, LIMBS>

§

impl<MOD, const LIMBS: usize> !RefUnwindSafe for ConstMontyFormInverter<MOD, LIMBS>

§

impl<MOD, const LIMBS: usize> !Send for ConstMontyFormInverter<MOD, LIMBS>

§

impl<MOD, const LIMBS: usize> !Sync for ConstMontyFormInverter<MOD, LIMBS>

§

impl<MOD, const LIMBS: usize> !Unpin for ConstMontyFormInverter<MOD, LIMBS>

§

impl<MOD, const LIMBS: usize> !UnwindSafe for ConstMontyFormInverter<MOD, LIMBS>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.