pub struct PrimeParams<const LIMBS: usize> {
pub(super) s: NonZeroU32,
pub(super) t: OddUint<LIMBS>,
pub(super) generator: NonZeroU32,
pub(super) sqrt_exp: Uint<LIMBS>,
pub(super) monty_root_unity: Uint<LIMBS>,
pub(super) monty_root_unity_p2: Uint<LIMBS>,
}Expand description
Parameters for supporting efficient computations on integers in Montgomery form with a prime modulus.
Fields§
§s: NonZeroU32The largest power of two that divides (modulus - 1).
t: OddUint<LIMBS>The result of dividing modulus - 1 by 2^s.
generator: NonZeroU32The smallest primitive root of the modulus.
sqrt_exp: Uint<LIMBS>The exponent to use in computing a modular square root.
monty_root_unity: Uint<LIMBS>An s’th root of unity for the modulus, in Montgomery form.
monty_root_unity_p2: Uint<LIMBS>Equal to monty_root_unity^2 mod p.
Implementations§
Source§impl<const LIMBS: usize> PrimeParams<LIMBS>
impl<const LIMBS: usize> PrimeParams<LIMBS>
Sourcepub const fn new_vartime(
params: &FixedMontyParams<LIMBS>,
generator: u32,
) -> Self
pub const fn new_vartime( params: &FixedMontyParams<LIMBS>, generator: u32, ) -> Self
Instantiates a new set of PrimeParams given FixedMontyParams for a prime modulus.
The value generator must be a multiplicative generator (ie. primitive element) of the
finite field, having order modulus-1. Its powers generate all nonzero elements of the
field: generator^0, generator^1, ..., generator^(modulus-2) enumerate [1, modulus-1].
Sourcepub const fn generator(&self) -> NonZeroU32
pub const fn generator(&self) -> NonZeroU32
Get the constant ‘generator’ used in modular square root calculation.
Sourcepub const fn s(&self) -> NonZeroU32
pub const fn s(&self) -> NonZeroU32
Get the constant ‘s’ used in modular square root calculation.
Trait Implementations§
Source§impl<const LIMBS: usize> Clone for PrimeParams<LIMBS>
impl<const LIMBS: usize> Clone for PrimeParams<LIMBS>
Source§fn clone(&self) -> PrimeParams<LIMBS>
fn clone(&self) -> PrimeParams<LIMBS>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<const LIMBS: usize> CtAssign for PrimeParams<LIMBS>
impl<const LIMBS: usize> CtAssign for PrimeParams<LIMBS>
Source§impl<const LIMBS: usize> CtAssignSlice for PrimeParams<LIMBS>
impl<const LIMBS: usize> CtAssignSlice for PrimeParams<LIMBS>
Source§fn ct_assign_slice(dst: &mut [Self], src: &[Self], choice: Choice)
fn ct_assign_slice(dst: &mut [Self], src: &[Self], choice: Choice)
Source§impl<const LIMBS: usize> CtEq for PrimeParams<LIMBS>
impl<const LIMBS: usize> CtEq for PrimeParams<LIMBS>
Source§impl<const LIMBS: usize> CtEqSlice for PrimeParams<LIMBS>
impl<const LIMBS: usize> CtEqSlice for PrimeParams<LIMBS>
Source§fn ct_eq_slice(a: &[Self], b: &[Self]) -> Choice
fn ct_eq_slice(a: &[Self], b: &[Self]) -> Choice
a is equal to b in constant-time.Source§fn ct_ne_slice(a: &[Self], b: &[Self]) -> Choice
fn ct_ne_slice(a: &[Self], b: &[Self]) -> Choice
a is NOT equal to b in constant-time.