Trait Inverter

Source
pub trait Inverter {
    type Output;

    // Required methods
    fn invert(&self, value: &Self::Output) -> CtOption<Self::Output>;
    fn invert_vartime(&self, value: &Self::Output) -> CtOption<Self::Output>;
}
Expand description

Trait impl’d by precomputed modular inverters obtained via the PrecomputeInverter trait.

Required Associated Types§

Source

type Output

Output of an inversion.

Required Methods§

Source

fn invert(&self, value: &Self::Output) -> 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: &Self::Output) -> 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).

This version is variable-time with respect to value.

Implementors§

Source§

impl Inverter for BoxedSafeGcdInverter

Available on crate feature alloc only.
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>

Source§

impl<const LIMBS: usize> Inverter for MontyFormInverter<LIMBS>
where Odd<Uint<LIMBS>>: PrecomputeInverter<Output = Uint<LIMBS>>,

Source§

impl<const SAT_LIMBS: usize, const UNSAT_LIMBS: usize> Inverter for SafeGcdInverter<SAT_LIMBS, UNSAT_LIMBS>

Source§

type Output = Uint<SAT_LIMBS>