Skip to main content

ConstMontyForm

Struct ConstMontyForm 

Source
pub struct ConstMontyForm<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> { /* private fields */ }
Expand description

An integer in Montgomery form modulo MOD, represented using LIMBS limbs. The modulus is constant, so it cannot be set at runtime.

Internally, the value is stored in Montgomery form (multiplied by MOD::PARAMS.one) until it is retrieved.

Implementations§

Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ConstMontyForm<MOD, LIMBS>

Source

pub const fn add(&self, rhs: &ConstMontyForm<MOD, LIMBS>) -> Self

Adds rhs.

Source

pub const fn double(&self) -> Self

Double self.

Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ConstMontyForm<MOD, LIMBS>

Source

pub const fn inv(&self) -> CtOption<Self>

👎Deprecated since 0.7.0:

please use invert instead

Computes self^-1 representing the multiplicative inverse of self, i.e. self * self^-1 = 1.

If the number was invertible, the second element of the tuple is the truthy value, otherwise it is the falsy value (in which case the first element’s value is unspecified).

Source

pub const fn invert(&self) -> CtOption<Self>

Computes self^-1 representing the multiplicative inverse of self, i.e. self * self^-1 = 1.

If the number was invertible, the second element of the tuple is the truthy value, otherwise it is the falsy value (in which case the first element’s value is unspecified).

Source

pub const fn inv_vartime(&self) -> CtOption<Self>

👎Deprecated since 0.7.0:

please use invert_vartime instead

Computes self^-1 representing the multiplicative inverse of self, i.e. self * self^-1 = 1.

If the number was invertible, the second element of the tuple is the truthy value, otherwise it is the falsy value (in which case the first element’s value is unspecified).

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

Source

pub const fn invert_vartime(&self) -> CtOption<Self>

Computes self^-1 representing the multiplicative inverse of self, i.e. self * self^-1 = 1.

If the number was invertible, the second element of the tuple is the truthy value, otherwise it is the falsy value (in which case the first element’s value is unspecified).

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

Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ConstMontyForm<MOD, LIMBS>

Source

pub const fn lincomb(products: &[(Self, Self)]) -> Self

Calculate the sum of products of pairs (a, b) in products.

Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ConstMontyForm<MOD, LIMBS>

Source

pub const fn jacobi_symbol(&self) -> JacobiSymbol

Compute the Jacobi symbol (self|modulus).

For a prime modulus, this corresponds to the Legendre symbol and indicates whether self is quadratic residue.

Source

pub const fn jacobi_symbol_vartime(&self) -> JacobiSymbol

Compute the Jacobi symbol (self|modulus).

For a prime modulus, this corresponds to the Legendre symbol and indicates whether self is quadratic residue.

This method is variable-time with respect to the value of self.

Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ConstMontyForm<MOD, LIMBS>

Source

pub const fn mul(&self, rhs: &Self) -> Self

Multiplies by rhs.

Source

pub const fn square(&self) -> Self

Computes the (reduced) square.

Source

pub const fn square_repeat_vartime(&self, n: u32) -> Self

Computes the reduced product self^2n.

This method is variable time in n only.

Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ConstMontyForm<MOD, LIMBS>

Source

pub const fn neg(&self) -> Self

Negates the number.

Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ConstMontyForm<MOD, LIMBS>

Source

pub const fn pow<const RHS_LIMBS: usize>( &self, exponent: &Uint<RHS_LIMBS>, ) -> Self

Raises to the exponent power.

Source

pub const fn pow_bounded_exp<const RHS_LIMBS: usize>( &self, exponent: &Uint<RHS_LIMBS>, exponent_bits: u32, ) -> Self

Raises to the exponent power, with exponent_bits representing the number of (least significant) bits to take into account for the exponent.

NOTE: exponent_bits may be leaked in the time pattern.

Source

pub const fn pow_vartime<const RHS_LIMBS: usize>( &self, exponent: &Uint<RHS_LIMBS>, ) -> Self

Raises to the exponent power.

This method is variable time in exponent.

Source

pub fn pow_amm(&self, exponent: &Uint<LIMBS>) -> Self

Raises to the exponent power using Almost Montgomery Multiplication (AMM).

Source

pub fn pow_amm_bounded_exp( &self, exponent: &Uint<LIMBS>, exponent_bits: u32, ) -> Self

Raises to the exponent power using Almost Montgomery Multiplication (AMM) with exponent_bits representing the number of (least significant) bits to take into account for the exponent.

NOTE: exponent_bits may be leaked in the time pattern.

Source§

impl<const LIMBS: usize, MOD> ConstMontyForm<MOD, LIMBS>
where MOD: ConstPrimeMontyParams<LIMBS>,

Source

pub const fn sqrt(&self) -> CtOption<Self>

Compute the modular square root for self, if it exists.

Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ConstMontyForm<MOD, LIMBS>

Source

pub const fn sub(&self, rhs: &Self) -> Self

Subtracts rhs.

Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ConstMontyForm<MOD, LIMBS>

Source

pub const ZERO: Self

The representation of 0 mod MOD.

Source

pub const ONE: Self

The representation of 1 mod MOD.

Source

pub const MODULUS: Odd<Uint<LIMBS>>

Modulus as an unsigned integer.

Source

pub const fn new(integer: &Uint<LIMBS>) -> Self

Instantiates a new ConstMontyForm that represents this integer mod MOD.

Source

pub const fn retrieve(&self) -> Uint<LIMBS>

Retrieves the integer currently encoded in this ConstMontyForm, guaranteed to be reduced.

Source

pub const fn as_montgomery(&self) -> &Uint<LIMBS>

Access the ConstMontyForm value in Montgomery form.

Source

pub fn as_montgomery_mut(&mut self) -> &mut Uint<LIMBS>

Mutably access the ConstMontyForm value in Montgomery form.

Source

pub const fn from_montgomery(integer: Uint<LIMBS>) -> Self

Create a ConstMontyForm from a value in Montgomery form.

Source

pub const fn to_montgomery(&self) -> Uint<LIMBS>

Extract the value from the ConstMontyForm in Montgomery form.

Source

pub const fn div_by_2(&self) -> Self

Performs division by 2, that is returns x such that x + x = self.

Trait Implementations§

Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Add<&ConstMontyForm<MOD, LIMBS>> for &ConstMontyForm<MOD, LIMBS>

Source§

type Output = ConstMontyForm<MOD, LIMBS>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &ConstMontyForm<MOD, LIMBS>) -> ConstMontyForm<MOD, LIMBS>

Performs the + operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Add<&ConstMontyForm<MOD, LIMBS>> for ConstMontyForm<MOD, LIMBS>

Source§

type Output = ConstMontyForm<MOD, LIMBS>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &ConstMontyForm<MOD, LIMBS>) -> ConstMontyForm<MOD, LIMBS>

Performs the + operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Add<ConstMontyForm<MOD, LIMBS>> for &ConstMontyForm<MOD, LIMBS>

Source§

type Output = ConstMontyForm<MOD, LIMBS>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: ConstMontyForm<MOD, LIMBS>) -> ConstMontyForm<MOD, LIMBS>

Performs the + operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Add for ConstMontyForm<MOD, LIMBS>

Source§

type Output = ConstMontyForm<MOD, LIMBS>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: ConstMontyForm<MOD, LIMBS>) -> ConstMontyForm<MOD, LIMBS>

Performs the + operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> AddAssign<&ConstMontyForm<MOD, LIMBS>> for ConstMontyForm<MOD, LIMBS>

Source§

fn add_assign(&mut self, rhs: &Self)

Performs the += operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> AddAssign for ConstMontyForm<MOD, LIMBS>

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<MOD: Clone + ConstMontyParams<LIMBS>, const LIMBS: usize> Clone for ConstMontyForm<MOD, LIMBS>

Source§

fn clone(&self) -> ConstMontyForm<MOD, LIMBS>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<MOD, const LIMBS: usize> ConditionallySelectable for ConstMontyForm<MOD, LIMBS>
where MOD: ConstMontyParams<LIMBS> + Copy,

Available on crate feature subtle only.
Source§

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice. Read more
Source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
Source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ConstOne for ConstMontyForm<MOD, LIMBS>

Source§

const ONE: Self = Self::ONE

The multiplicative identity element of Self, 1.
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> ConstZero for ConstMontyForm<MOD, LIMBS>

Source§

const ZERO: Self = Self::ZERO

The additive identity element of Self, 0.
Source§

impl<MOD, const LIMBS: usize> ConstantTimeEq for ConstMontyForm<MOD, LIMBS>
where MOD: ConstMontyParams<LIMBS>,

Available on crate feature subtle only.
Source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if two items are equal. Read more
Source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
Source§

impl<MOD, const LIMBS: usize> CtAssign for ConstMontyForm<MOD, LIMBS>
where MOD: ConstMontyParams<LIMBS>,

Source§

fn ct_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign src to self if choice is Choice::TRUE.
Source§

impl<MOD, const LIMBS: usize> CtAssignSlice for ConstMontyForm<MOD, LIMBS>
where MOD: ConstMontyParams<LIMBS>,

Source§

fn ct_assign_slice(dst: &mut [Self], src: &[Self], choice: Choice)

Conditionally assign src to dst if choice is Choice::TRUE, or leave it unchanged for Choice::FALSE.
Source§

impl<MOD, const LIMBS: usize> CtEq for ConstMontyForm<MOD, LIMBS>
where MOD: ConstMontyParams<LIMBS>,

Source§

fn ct_eq(&self, other: &Self) -> Choice

Determine if self is equal to other in constant-time.
Source§

fn ct_ne(&self, other: &Rhs) -> Choice

Determine if self is NOT equal to other in constant-time.
Source§

impl<MOD, const LIMBS: usize> CtEqSlice for ConstMontyForm<MOD, LIMBS>
where MOD: ConstMontyParams<LIMBS>,

Source§

fn ct_eq_slice(a: &[Self], b: &[Self]) -> Choice

Determine if a is equal to b in constant-time.
Source§

fn ct_ne_slice(a: &[Self], b: &[Self]) -> Choice

Determine if a is NOT equal to b in constant-time.
Source§

impl<MOD: Debug + ConstMontyParams<LIMBS>, const LIMBS: usize> Debug for ConstMontyForm<MOD, LIMBS>

Source§

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

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

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Default for ConstMontyForm<MOD, LIMBS>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, MOD, const LIMBS: usize> Deserialize<'de> for ConstMontyForm<MOD, LIMBS>
where MOD: ConstMontyParams<LIMBS>, Uint<LIMBS>: Encoding,

Available on crate feature serde only.
Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<const LIMBS: usize, P: ConstMontyParams<LIMBS>> From<&ConstMontyForm<P, LIMBS>> for FixedMontyForm<LIMBS>

Source§

fn from(const_monty_form: &ConstMontyForm<P, LIMBS>) -> Self

Converts to this type from the input type.
Source§

impl<const LIMBS: usize, Params> From<&ConstMontyForm<Params, LIMBS>> for BoxedMontyForm
where Params: ConstMontyParams<LIMBS>,

Available on crate feature alloc only.
Source§

fn from(input: &ConstMontyForm<Params, LIMBS>) -> Self

Converts to this type from the input type.
Source§

impl<const LIMBS: usize, Params> From<ConstMontyForm<Params, LIMBS>> for BoxedMontyForm
where Params: ConstMontyParams<LIMBS>,

Available on crate feature alloc only.
Source§

fn from(input: ConstMontyForm<Params, LIMBS>) -> Self

Converts to this type from the input type.
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Invert for ConstMontyForm<MOD, LIMBS>

Source§

type Output = CtOption<ConstMontyForm<MOD, LIMBS>>

Output of the inversion.
Source§

fn invert(&self) -> Self::Output

Computes the inverse.
Source§

fn invert_vartime(&self) -> Self::Output

Computes the inverse in variable-time.
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Mul<&ConstMontyForm<MOD, LIMBS>> for &ConstMontyForm<MOD, LIMBS>

Source§

type Output = ConstMontyForm<MOD, LIMBS>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &ConstMontyForm<MOD, LIMBS>) -> ConstMontyForm<MOD, LIMBS>

Performs the * operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Mul<&ConstMontyForm<MOD, LIMBS>> for ConstMontyForm<MOD, LIMBS>

Source§

type Output = ConstMontyForm<MOD, LIMBS>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &ConstMontyForm<MOD, LIMBS>) -> ConstMontyForm<MOD, LIMBS>

Performs the * operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Mul<ConstMontyForm<MOD, LIMBS>> for &ConstMontyForm<MOD, LIMBS>

Source§

type Output = ConstMontyForm<MOD, LIMBS>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: ConstMontyForm<MOD, LIMBS>) -> ConstMontyForm<MOD, LIMBS>

Performs the * operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Mul for ConstMontyForm<MOD, LIMBS>

Source§

type Output = ConstMontyForm<MOD, LIMBS>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: ConstMontyForm<MOD, LIMBS>) -> ConstMontyForm<MOD, LIMBS>

Performs the * operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> MulAssign<&ConstMontyForm<MOD, LIMBS>> for ConstMontyForm<MOD, LIMBS>

Source§

fn mul_assign(&mut self, rhs: &ConstMontyForm<MOD, LIMBS>)

Performs the *= operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> MulAssign for ConstMontyForm<MOD, LIMBS>

Source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize, const RHS_LIMBS: usize> MultiExponentiateBoundedExp<Uint<RHS_LIMBS>, [(ConstMontyForm<MOD, LIMBS>, Uint<RHS_LIMBS>)]> for ConstMontyForm<MOD, LIMBS>

Available on crate feature alloc only.
Source§

fn multi_exponentiate_bounded_exp( bases_and_exponents: &[(Self, Uint<RHS_LIMBS>)], exponent_bits: u32, ) -> Self

Calculates x1 ^ k1 * ... * xn ^ kn.
Source§

impl<const N: usize, MOD: ConstMontyParams<LIMBS>, const LIMBS: usize, const RHS_LIMBS: usize> MultiExponentiateBoundedExp<Uint<RHS_LIMBS>, [(ConstMontyForm<MOD, LIMBS>, Uint<RHS_LIMBS>); N]> for ConstMontyForm<MOD, LIMBS>

Source§

fn multi_exponentiate_bounded_exp( bases_and_exponents: &[(Self, Uint<RHS_LIMBS>); N], exponent_bits: u32, ) -> Self

Calculates x1 ^ k1 * ... * xn ^ kn.
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Neg for &ConstMontyForm<MOD, LIMBS>

Source§

type Output = ConstMontyForm<MOD, LIMBS>

The resulting type after applying the - operator.
Source§

fn neg(self) -> ConstMontyForm<MOD, LIMBS>

Performs the unary - operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Neg for ConstMontyForm<MOD, LIMBS>

Source§

type Output = ConstMontyForm<MOD, LIMBS>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> One for ConstMontyForm<MOD, LIMBS>

Source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1.
Source§

fn is_one(&self) -> Choice

Determine if this value is equal to 1. Read more
Source§

fn set_one(&mut self)

Set self to its multiplicative identity, i.e. Self::one.
Source§

fn one_like(_other: &Self) -> Self

Return the value 0 with the same precision as other.
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> One for ConstMontyForm<MOD, LIMBS>

Source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn is_one(&self) -> bool

Returns true if self is equal to the multiplicative identity. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

impl<MOD: PartialEq + ConstMontyParams<LIMBS>, const LIMBS: usize> PartialEq for ConstMontyForm<MOD, LIMBS>

Source§

fn eq(&self, other: &ConstMontyForm<MOD, LIMBS>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize, const RHS_LIMBS: usize> PowBoundedExp<Uint<RHS_LIMBS>> for ConstMontyForm<MOD, LIMBS>

Source§

fn pow_bounded_exp( &self, exponent: &Uint<RHS_LIMBS>, exponent_bits: u32, ) -> Self

Raises to the exponent power, with exponent_bits representing the number of (least significant) bits to take into account for the exponent. Read more
Source§

impl<MOD, const LIMBS: usize> Random for ConstMontyForm<MOD, LIMBS>
where MOD: ConstMontyParams<LIMBS>,

Available on crate feature rand_core only.
Source§

fn try_random_from_rng<R: TryRng + ?Sized>( rng: &mut R, ) -> Result<Self, R::Error>

Generate a random value. Read more
Source§

fn random_from_rng<R: Rng + ?Sized>(rng: &mut R) -> Self

Generate a random value. Read more
Source§

fn try_random() -> Result<Self, Error>

Available on crate feature getrandom only.
Randomly generate a value of this type using the system’s ambient cryptographically secure random number generator. Read more
Source§

fn random() -> Self

Available on crate feature getrandom only.
Randomly generate a value of this type using the system’s ambient cryptographically secure random number generator. Read more
Source§

impl<const LIMBS: usize, MOD> Reduce<Uint<LIMBS>> for ConstMontyForm<MOD, LIMBS>
where MOD: ConstMontyParams<LIMBS>,

Source§

fn reduce(value: &Uint<LIMBS>) -> Self

Reduces self modulo Modulus.
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Retrieve for ConstMontyForm<MOD, LIMBS>

Source§

type Output = Uint<LIMBS>

The original type.
Source§

fn retrieve(&self) -> Self::Output

Convert the number back from the optimized representation.
Source§

impl<MOD, const LIMBS: usize> Serialize for ConstMontyForm<MOD, LIMBS>
where MOD: ConstMontyParams<LIMBS>, Uint<LIMBS>: Encoding,

Available on crate feature serde only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Square for ConstMontyForm<MOD, LIMBS>

Source§

fn square(&self) -> Self

Computes the same as self * self, but may be more efficient.
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Sub<&ConstMontyForm<MOD, LIMBS>> for &ConstMontyForm<MOD, LIMBS>

Source§

type Output = ConstMontyForm<MOD, LIMBS>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &ConstMontyForm<MOD, LIMBS>) -> ConstMontyForm<MOD, LIMBS>

Performs the - operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Sub<&ConstMontyForm<MOD, LIMBS>> for ConstMontyForm<MOD, LIMBS>

Source§

type Output = ConstMontyForm<MOD, LIMBS>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &ConstMontyForm<MOD, LIMBS>) -> ConstMontyForm<MOD, LIMBS>

Performs the - operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Sub<ConstMontyForm<MOD, LIMBS>> for &ConstMontyForm<MOD, LIMBS>

Source§

type Output = ConstMontyForm<MOD, LIMBS>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: ConstMontyForm<MOD, LIMBS>) -> ConstMontyForm<MOD, LIMBS>

Performs the - operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Sub for ConstMontyForm<MOD, LIMBS>

Source§

type Output = ConstMontyForm<MOD, LIMBS>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: ConstMontyForm<MOD, LIMBS>) -> ConstMontyForm<MOD, LIMBS>

Performs the - operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> SubAssign<&ConstMontyForm<MOD, LIMBS>> for ConstMontyForm<MOD, LIMBS>

Source§

fn sub_assign(&mut self, rhs: &Self)

Performs the -= operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> SubAssign for ConstMontyForm<MOD, LIMBS>

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Zero for ConstMontyForm<MOD, LIMBS>

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0.
Source§

fn is_zero(&self) -> Choice

Determine if this value is equal to 0. Read more
Source§

fn set_zero(&mut self)

Set self to its additive identity, i.e. Self::zero.
Source§

fn zero_like(other: &Self) -> Self
where Self: Clone,

Return the value 0 with the same precision as other.
Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> Zero for ConstMontyForm<MOD, LIMBS>

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl<MOD: Copy + ConstMontyParams<LIMBS>, const LIMBS: usize> Copy for ConstMontyForm<MOD, LIMBS>

Source§

impl<MOD, const LIMBS: usize> CtSelectUsingCtAssign for ConstMontyForm<MOD, LIMBS>
where MOD: ConstMontyParams<LIMBS>,

Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> DefaultIsZeroes for ConstMontyForm<MOD, LIMBS>

Available on crate feature zeroize only.
Source§

impl<MOD: Eq + ConstMontyParams<LIMBS>, const LIMBS: usize> Eq for ConstMontyForm<MOD, LIMBS>

Source§

impl<MOD: ConstMontyParams<LIMBS>, const LIMBS: usize> StructuralPartialEq for ConstMontyForm<MOD, LIMBS>

Auto Trait Implementations§

§

impl<MOD, const LIMBS: usize> Freeze for ConstMontyForm<MOD, LIMBS>

§

impl<MOD, const LIMBS: usize> RefUnwindSafe for ConstMontyForm<MOD, LIMBS>
where MOD: RefUnwindSafe,

§

impl<MOD, const LIMBS: usize> Send for ConstMontyForm<MOD, LIMBS>

§

impl<MOD, const LIMBS: usize> Sync for ConstMontyForm<MOD, LIMBS>

§

impl<MOD, const LIMBS: usize> Unpin for ConstMontyForm<MOD, LIMBS>
where MOD: Unpin,

§

impl<MOD, const LIMBS: usize> UnsafeUnpin for ConstMontyForm<MOD, LIMBS>

§

impl<MOD, const LIMBS: usize> UnwindSafe for ConstMontyForm<MOD, LIMBS>
where MOD: UnwindSafe,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ConditionallyNegatable for T
where T: ConditionallySelectable, &'a T: for<'a> Neg<Output = T>,

Source§

fn conditional_negate(&mut self, choice: Choice)

Negate self if choice == Choice(1); otherwise, leave it unchanged. Read more
Source§

impl<T> CtSelect for T

Source§

fn ct_select(&self, other: &T, choice: Choice) -> T

Select between self and other based on choice, returning a copy of the value. Read more
Source§

fn ct_swap(&mut self, other: &mut Self, choice: Choice)

Conditionally swap self and other if choice is Choice::TRUE.
Source§

impl<T, const N: usize> CtSelectArray<N> for T

Source§

fn ct_select_array(a: &[T; N], b: &[T; N], choice: Choice) -> [T; N]

Select between a and b in constant-time based on choice.
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, Exponent, BasesAndExponents> MultiExponentiate<Exponent, BasesAndExponents> for T
where T: MultiExponentiateBoundedExp<Exponent, BasesAndExponents>, Exponent: Bounded, BasesAndExponents: AsRef<[(T, Exponent)]> + ?Sized,

Source§

fn multi_exponentiate(bases_and_exponents: &BasesAndExponents) -> T

Calculates x1 ^ k1 * ... * xn ^ kn.
Source§

impl<T, Exponent> Pow<Exponent> for T
where T: PowBoundedExp<Exponent>, Exponent: Unsigned,

Source§

fn pow(&self, exponent: &Exponent) -> T

Raises to the exponent power.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<Z> Zeroize for Z
where Z: DefaultIsZeroes,

Source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,