pub trait ResidueParams<const LIMBS: usize>: Copy + Debug + Default + Eq + Send + Sync + 'static {
    const LIMBS: usize;
    const MODULUS: Uint<LIMBS>;
    const R: Uint<LIMBS>;
    const R2: Uint<LIMBS>;
    const R3: Uint<LIMBS>;
    const MOD_NEG_INV: Limb;
}
Expand description

The parameters to efficiently go to and from the Montgomery form for a given odd modulus. An easy way to generate these parameters is using the impl_modulus! macro. These parameters are constant, so they cannot be set at runtime.

Unfortunately, LIMBS must be generic for now until const generics are stabilized.

Required Associated Constants§

source

const LIMBS: usize

Number of limbs required to encode a residue

source

const MODULUS: Uint<LIMBS>

The constant modulus

source

const R: Uint<LIMBS>

Parameter used in Montgomery reduction

source

const R2: Uint<LIMBS>

R^2, used to move into Montgomery form

source

const R3: Uint<LIMBS>

R^3, used to perform a multiplicative inverse

source

const MOD_NEG_INV: Limb

The lowest limbs of -(MODULUS^-1) mod R

Object Safety§

This trait is not object safe.

Implementors§