pub struct MontyFieldElement<MOD, const LIMBS: usize>where
MOD: MontyFieldParams<LIMBS>,{
inner: ConstMontyForm<MOD, LIMBS>,
}Expand description
Field element type which uses an internal Montgomery form representation.
Fields§
§inner: ConstMontyForm<MOD, LIMBS>Implementations§
Source§impl<MOD, const LIMBS: usize> MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Sourcepub fn from_bytes(repr: &MontyFieldBytes<MOD, LIMBS>) -> CtOption<Self>where
Uint<LIMBS>: ArrayEncoding,
pub fn from_bytes(repr: &MontyFieldBytes<MOD, LIMBS>) -> CtOption<Self>where
Uint<LIMBS>: ArrayEncoding,
Decode field element from a canonical bytestring representation.
Sourcepub fn from_slice(slice: &[u8]) -> Option<Self>where
Uint<LIMBS>: ArrayEncoding,
pub fn from_slice(slice: &[u8]) -> Option<Self>where
Uint<LIMBS>: ArrayEncoding,
Decode field element from a canonical byte slice.
Slice is expected to be zero padded to the expected byte size.
Sourcepub const fn from_hex_vartime(hex: &str) -> Self
pub const fn from_hex_vartime(hex: &str) -> Self
Decode a field element from hex-encoded bytes.
This is primarily intended for defining constants using hex literals.
§Panics
- When hex is malformed
- When input is the wrong length
- If input overflows the modulus
Sourcepub const fn from_uint_reduced(uint: &Uint<LIMBS>) -> Self
pub const fn from_uint_reduced(uint: &Uint<LIMBS>) -> Self
Convert Uint into MontyFieldElement, first converting it into Montgomery form:
w * R^2 * R^-1 mod p = wR mod pReduces the input modulo p.
Sourcepub fn from_uint(uint: &Uint<LIMBS>) -> CtOption<Self>
pub fn from_uint(uint: &Uint<LIMBS>) -> CtOption<Self>
Convert Uint into MontyFieldElement, first converting it into Montgomery form:
w * R^2 * R^-1 mod p = wR mod p§Returns
The CtOption equivalent of None if the input overflows the modulus.
Sourcepub const fn from_montgomery(uint: Uint<LIMBS>) -> Self
pub const fn from_montgomery(uint: Uint<LIMBS>) -> Self
Create MontyFieldElement from a Uint which is already in Montgomery form.
§⚠️ Warning
This value is expected to be in Montgomery form and reduced. Failure to maintain these invariants will lead to miscomputation and potential security issues!
Sourcepub const fn from_montgomery_words(words: [Word; LIMBS]) -> Self
pub const fn from_montgomery_words(words: [Word; LIMBS]) -> Self
Helper function to construct MontyFieldElement from words in Montgomery form.
Sourcepub const fn as_montgomery(&self) -> &Uint<LIMBS>
pub const fn as_montgomery(&self) -> &Uint<LIMBS>
Borrow the inner Uint type which is in Montgomery form.
§⚠️ Warning
Make sure you are actually expecting a value in Montgomery form! This is not the correct
function for converting out of Montgomery form: that would be
MontyFieldElement::to_canonical.
Sourcepub const fn to_montgomery_words(&self) -> [Word; LIMBS]
pub const fn to_montgomery_words(&self) -> [Word; LIMBS]
Retrieve the Montgomery form representation as an array of Words.
Sourcepub fn to_bytes(self) -> MontyFieldBytes<MOD, LIMBS>
pub fn to_bytes(self) -> MontyFieldBytes<MOD, LIMBS>
Returns the bytestring encoding of this field element.
Sourcepub fn is_odd(&self) -> Choice
pub fn is_odd(&self) -> Choice
Determine if this field element is odd: self mod 2 == 1.
§Returns
If odd, return Choice(1). Otherwise, return Choice(0).
Sourcepub fn is_even(&self) -> Choice
pub fn is_even(&self) -> Choice
Determine if this field element is even: self mod 2 == 0.
§Returns
If even, return Choice(1). Otherwise, return Choice(0).
Sourcepub fn is_zero(&self) -> Choice
pub fn is_zero(&self) -> Choice
Determine if this field element is zero.
§Returns
If zero, return Choice(1). Otherwise, return Choice(0).
Sourcepub const fn to_canonical(self) -> Uint<LIMBS>
pub const fn to_canonical(self) -> Uint<LIMBS>
Translate field element out of the Montgomery domain, returning a Uint in canonical form.
Sourcepub fn invert_vartime(&self) -> CtOption<Self>
pub fn invert_vartime(&self) -> CtOption<Self>
Compute field inversion: 1 / self in variable-time.
Sourcepub const fn const_invert(&self) -> Self
pub const fn const_invert(&self) -> Self
Compute field inversion as a const fn. Panics if self is zero.
This is mainly intended for inverting constants at compile time.
Sourcepub const fn pow_vartime<const RHS_LIMBS: usize>(
&self,
exp: &Uint<RHS_LIMBS>,
) -> Self
pub const fn pow_vartime<const RHS_LIMBS: usize>( &self, exp: &Uint<RHS_LIMBS>, ) -> Self
Returns self^exp, where exp is a little-endian integer exponent.
This operation is variable time with respect to the exponent exp.
If exp is fixed, this operation is constant time. Note that exp will still be branched
upon and should NOT be a secret.
Sourcepub const fn sqn_vartime(&self, n: usize) -> Self
pub const fn sqn_vartime(&self, n: usize) -> Self
Returns self^(2^n) mod p.
This operation is variable time with respect to the exponent n.
If the exponent is fixed, this operation is constant time.
Trait Implementations§
Source§impl<MOD, const LIMBS: usize> Add<&MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Add<&MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§type Output = MontyFieldElement<MOD, LIMBS>
type Output = MontyFieldElement<MOD, LIMBS>
+ operator.Source§fn add(
self,
rhs: &MontyFieldElement<MOD, LIMBS>,
) -> MontyFieldElement<MOD, LIMBS>
fn add( self, rhs: &MontyFieldElement<MOD, LIMBS>, ) -> MontyFieldElement<MOD, LIMBS>
+ operation. Read moreSource§impl<MOD, const LIMBS: usize> Add for &MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Add for &MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§type Output = MontyFieldElement<MOD, LIMBS>
type Output = MontyFieldElement<MOD, LIMBS>
+ operator.Source§fn add(
self,
rhs: &MontyFieldElement<MOD, LIMBS>,
) -> MontyFieldElement<MOD, LIMBS>
fn add( self, rhs: &MontyFieldElement<MOD, LIMBS>, ) -> MontyFieldElement<MOD, LIMBS>
+ operation. Read moreSource§impl<MOD, const LIMBS: usize> Add for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Add for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§type Output = MontyFieldElement<MOD, LIMBS>
type Output = MontyFieldElement<MOD, LIMBS>
+ operator.Source§fn add(
self,
rhs: MontyFieldElement<MOD, LIMBS>,
) -> MontyFieldElement<MOD, LIMBS>
fn add( self, rhs: MontyFieldElement<MOD, LIMBS>, ) -> MontyFieldElement<MOD, LIMBS>
+ operation. Read moreSource§impl<MOD, const LIMBS: usize> AddAssign<&MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> AddAssign<&MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§fn add_assign(&mut self, other: &MontyFieldElement<MOD, LIMBS>)
fn add_assign(&mut self, other: &MontyFieldElement<MOD, LIMBS>)
+= operation. Read moreSource§impl<MOD, const LIMBS: usize> AddAssign for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> AddAssign for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§fn add_assign(&mut self, other: MontyFieldElement<MOD, LIMBS>)
fn add_assign(&mut self, other: MontyFieldElement<MOD, LIMBS>)
+= operation. Read moreSource§impl<MOD, const LIMBS: usize> Binary for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Binary for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> Clone for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS> + Clone,
impl<MOD, const LIMBS: usize> Clone for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS> + Clone,
Source§fn clone(&self) -> MontyFieldElement<MOD, LIMBS>
fn clone(&self) -> MontyFieldElement<MOD, LIMBS>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<MOD, const LIMBS: usize> ConditionallySelectable for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> ConditionallySelectable for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
Source§fn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
Source§fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
self and other if choice == 1; otherwise,
reassign both unto themselves. Read moreSource§impl<MOD, const LIMBS: usize> ConstMontyParams<LIMBS> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> ConstMontyParams<LIMBS> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> ConstantTimeEq for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> ConstantTimeEq for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> ConstantTimeGreater for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> ConstantTimeGreater for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> ConstantTimeLess for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> ConstantTimeLess for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> CtEq for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> CtEq for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> CtGt for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> CtGt for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> CtLt for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> CtLt for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> CtSelect for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> CtSelect for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> Debug for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Debug for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> Default for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Default for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> Display for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Display for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> Field for MontyFieldElement<MOD, LIMBS>
impl<MOD, const LIMBS: usize> Field for MontyFieldElement<MOD, LIMBS>
Source§fn try_random<R: TryRng + ?Sized>(rng: &mut R) -> Result<Self, R::Error>
fn try_random<R: TryRng + ?Sized>(rng: &mut R) -> Result<Self, R::Error>
Source§fn invert(&self) -> CtOption<Self>
fn invert(&self) -> CtOption<Self>
Source§fn sqrt(&self) -> CtOption<Self>
fn sqrt(&self) -> CtOption<Self>
Source§fn sqrt_ratio(num: &Self, div: &Self) -> (Choice, Self)
fn sqrt_ratio(num: &Self, div: &Self) -> (Choice, Self)
Source§fn random<R>(rng: &mut R) -> Self
fn random<R>(rng: &mut R) -> Self
Source§fn is_zero_vartime(&self) -> bool
fn is_zero_vartime(&self) -> bool
Source§impl<MOD, const LIMBS: usize> From<&MontyFieldElement<MOD, LIMBS>> for MontyFieldBytes<MOD, LIMBS>
impl<MOD, const LIMBS: usize> From<&MontyFieldElement<MOD, LIMBS>> for MontyFieldBytes<MOD, LIMBS>
Source§fn from(fe: &MontyFieldElement<MOD, LIMBS>) -> Self
fn from(fe: &MontyFieldElement<MOD, LIMBS>) -> Self
Source§impl<MOD, const LIMBS: usize> From<&MontyFieldElement<MOD, LIMBS>> for Uint<LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> From<&MontyFieldElement<MOD, LIMBS>> for Uint<LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§fn from(fe: &MontyFieldElement<MOD, LIMBS>) -> Uint<LIMBS>
fn from(fe: &MontyFieldElement<MOD, LIMBS>) -> Uint<LIMBS>
Source§impl<MOD, const LIMBS: usize> From<MontyFieldElement<MOD, LIMBS>> for MontyFieldBytes<MOD, LIMBS>
impl<MOD, const LIMBS: usize> From<MontyFieldElement<MOD, LIMBS>> for MontyFieldBytes<MOD, LIMBS>
Source§fn from(fe: MontyFieldElement<MOD, LIMBS>) -> Self
fn from(fe: MontyFieldElement<MOD, LIMBS>) -> Self
Source§impl<MOD, const LIMBS: usize> From<MontyFieldElement<MOD, LIMBS>> for Uint<LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> From<MontyFieldElement<MOD, LIMBS>> for Uint<LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§fn from(fe: MontyFieldElement<MOD, LIMBS>) -> Uint<LIMBS>
fn from(fe: MontyFieldElement<MOD, LIMBS>) -> Uint<LIMBS>
Source§impl<MOD, const LIMBS: usize> From<u128> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> From<u128> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§fn from(n: u128) -> MontyFieldElement<MOD, LIMBS>
fn from(n: u128) -> MontyFieldElement<MOD, LIMBS>
Source§impl<MOD, const LIMBS: usize> From<u32> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> From<u32> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§fn from(n: u32) -> MontyFieldElement<MOD, LIMBS>
fn from(n: u32) -> MontyFieldElement<MOD, LIMBS>
Source§impl<MOD, const LIMBS: usize> From<u64> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> From<u64> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§fn from(n: u64) -> MontyFieldElement<MOD, LIMBS>
fn from(n: u64) -> MontyFieldElement<MOD, LIMBS>
Source§impl<MOD, const LIMBS: usize> Generate for MontyFieldElement<MOD, LIMBS>
impl<MOD, const LIMBS: usize> Generate for MontyFieldElement<MOD, LIMBS>
Source§fn try_generate_from_rng<R: TryCryptoRng + ?Sized>(
rng: &mut R,
) -> Result<Self, R::Error>
fn try_generate_from_rng<R: TryCryptoRng + ?Sized>( rng: &mut R, ) -> Result<Self, R::Error>
TryCryptoRng. Read moreSource§fn generate_from_rng<R>(rng: &mut R) -> Self
fn generate_from_rng<R>(rng: &mut R) -> Self
CryptoRng.Source§impl<MOD, const LIMBS: usize> Invert for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
ConstMontyForm<MOD, LIMBS>: Invert<Output = CtOption<ConstMontyForm<MOD, LIMBS>>>,
impl<MOD, const LIMBS: usize> Invert for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
ConstMontyForm<MOD, LIMBS>: Invert<Output = CtOption<ConstMontyForm<MOD, LIMBS>>>,
Source§impl<MOD, const LIMBS: usize> LowerHex for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> LowerHex for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> Mul<&MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Mul<&MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§type Output = MontyFieldElement<MOD, LIMBS>
type Output = MontyFieldElement<MOD, LIMBS>
* operator.Source§fn mul(
self,
rhs: &MontyFieldElement<MOD, LIMBS>,
) -> MontyFieldElement<MOD, LIMBS>
fn mul( self, rhs: &MontyFieldElement<MOD, LIMBS>, ) -> MontyFieldElement<MOD, LIMBS>
* operation. Read moreSource§impl<MOD, const LIMBS: usize> Mul for &MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Mul for &MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§type Output = MontyFieldElement<MOD, LIMBS>
type Output = MontyFieldElement<MOD, LIMBS>
* operator.Source§fn mul(
self,
rhs: &MontyFieldElement<MOD, LIMBS>,
) -> MontyFieldElement<MOD, LIMBS>
fn mul( self, rhs: &MontyFieldElement<MOD, LIMBS>, ) -> MontyFieldElement<MOD, LIMBS>
* operation. Read moreSource§impl<MOD, const LIMBS: usize> Mul for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Mul for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§type Output = MontyFieldElement<MOD, LIMBS>
type Output = MontyFieldElement<MOD, LIMBS>
* operator.Source§fn mul(
self,
rhs: MontyFieldElement<MOD, LIMBS>,
) -> MontyFieldElement<MOD, LIMBS>
fn mul( self, rhs: MontyFieldElement<MOD, LIMBS>, ) -> MontyFieldElement<MOD, LIMBS>
* operation. Read moreSource§impl<MOD, const LIMBS: usize> MulAssign<&MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> MulAssign<&MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§fn mul_assign(&mut self, other: &MontyFieldElement<MOD, LIMBS>)
fn mul_assign(&mut self, other: &MontyFieldElement<MOD, LIMBS>)
*= operation. Read moreSource§impl<MOD, const LIMBS: usize> MulAssign for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> MulAssign for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§fn mul_assign(&mut self, other: MontyFieldElement<MOD, LIMBS>)
fn mul_assign(&mut self, other: MontyFieldElement<MOD, LIMBS>)
*= operation. Read moreSource§impl<MOD, const LIMBS: usize> Neg for &MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Neg for &MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§type Output = MontyFieldElement<MOD, LIMBS>
type Output = MontyFieldElement<MOD, LIMBS>
- operator.Source§fn neg(self) -> MontyFieldElement<MOD, LIMBS>
fn neg(self) -> MontyFieldElement<MOD, LIMBS>
- operation. Read moreSource§impl<MOD, const LIMBS: usize> Neg for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Neg for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§type Output = MontyFieldElement<MOD, LIMBS>
type Output = MontyFieldElement<MOD, LIMBS>
- operator.Source§fn neg(self) -> MontyFieldElement<MOD, LIMBS>
fn neg(self) -> MontyFieldElement<MOD, LIMBS>
- operation. Read moreSource§impl<MOD, const LIMBS: usize> Ord for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Ord for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD: MontyFieldParams<LIMBS>, const LIMBS: usize> PartialEq for MontyFieldElement<MOD, LIMBS>
impl<MOD: MontyFieldParams<LIMBS>, const LIMBS: usize> PartialEq for MontyFieldElement<MOD, LIMBS>
Source§impl<MOD, const LIMBS: usize> PartialOrd for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> PartialOrd for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> PrimeField for MontyFieldElement<MOD, LIMBS>
impl<MOD, const LIMBS: usize> PrimeField for MontyFieldElement<MOD, LIMBS>
Source§const MODULUS: &'static str = MOD::MODULUS_HEX
const MODULUS: &'static str = MOD::MODULUS_HEX
Source§const CAPACITY: u32
const CAPACITY: u32
Source§const MULTIPLICATIVE_GENERATOR: Self
const MULTIPLICATIVE_GENERATOR: Self
modulus - 1 order. This element must also be
a quadratic nonresidue. Read moreSource§const ROOT_OF_UNITY: Self
const ROOT_OF_UNITY: Self
2^s root of unity. Read moreSource§const ROOT_OF_UNITY_INV: Self
const ROOT_OF_UNITY_INV: Self
Self::ROOT_OF_UNITY.Source§type Repr = Array<u8, <MOD as MontyFieldParams<LIMBS>>::ByteSize>
type Repr = Array<u8, <MOD as MontyFieldParams<LIMBS>>::ByteSize>
Source§fn from_repr(bytes: Self::Repr) -> CtOption<Self>
fn from_repr(bytes: Self::Repr) -> CtOption<Self>
Source§fn to_repr(&self) -> Self::Repr
fn to_repr(&self) -> Self::Repr
Source§fn from_str_vartime(s: &str) -> Option<Self>
fn from_str_vartime(s: &str) -> Option<Self>
Source§impl<'a, MOD: MontyFieldParams<LIMBS>, const LIMBS: usize> Product<&'a MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>
impl<'a, MOD: MontyFieldParams<LIMBS>, const LIMBS: usize> Product<&'a MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>
Source§impl<MOD, const LIMBS: usize> Product for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Product for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> Reduce<Array<u8, <MOD as MontyFieldParams<LIMBS>>::ByteSize>> for MontyFieldElement<MOD, LIMBS>
impl<MOD, const LIMBS: usize> Reduce<Array<u8, <MOD as MontyFieldParams<LIMBS>>::ByteSize>> for MontyFieldElement<MOD, LIMBS>
Source§fn reduce(bytes: &MontyFieldBytes<MOD, LIMBS>) -> Self
fn reduce(bytes: &MontyFieldBytes<MOD, LIMBS>) -> Self
self modulo Modulus.Source§impl<MOD, const LIMBS: usize> Reduce<Uint<LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Reduce<Uint<LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> Retrieve for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Retrieve for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§impl<MOD, const LIMBS: usize> Sub<&MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Sub<&MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§type Output = MontyFieldElement<MOD, LIMBS>
type Output = MontyFieldElement<MOD, LIMBS>
- operator.Source§fn sub(
self,
rhs: &MontyFieldElement<MOD, LIMBS>,
) -> MontyFieldElement<MOD, LIMBS>
fn sub( self, rhs: &MontyFieldElement<MOD, LIMBS>, ) -> MontyFieldElement<MOD, LIMBS>
- operation. Read moreSource§impl<MOD, const LIMBS: usize> Sub for &MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Sub for &MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§type Output = MontyFieldElement<MOD, LIMBS>
type Output = MontyFieldElement<MOD, LIMBS>
- operator.Source§fn sub(
self,
rhs: &MontyFieldElement<MOD, LIMBS>,
) -> MontyFieldElement<MOD, LIMBS>
fn sub( self, rhs: &MontyFieldElement<MOD, LIMBS>, ) -> MontyFieldElement<MOD, LIMBS>
- operation. Read moreSource§impl<MOD, const LIMBS: usize> Sub for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> Sub for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§type Output = MontyFieldElement<MOD, LIMBS>
type Output = MontyFieldElement<MOD, LIMBS>
- operator.Source§fn sub(
self,
rhs: MontyFieldElement<MOD, LIMBS>,
) -> MontyFieldElement<MOD, LIMBS>
fn sub( self, rhs: MontyFieldElement<MOD, LIMBS>, ) -> MontyFieldElement<MOD, LIMBS>
- operation. Read moreSource§impl<MOD, const LIMBS: usize> SubAssign<&MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> SubAssign<&MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§fn sub_assign(&mut self, other: &MontyFieldElement<MOD, LIMBS>)
fn sub_assign(&mut self, other: &MontyFieldElement<MOD, LIMBS>)
-= operation. Read moreSource§impl<MOD, const LIMBS: usize> SubAssign for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<MOD, const LIMBS: usize> SubAssign for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§fn sub_assign(&mut self, other: MontyFieldElement<MOD, LIMBS>)
fn sub_assign(&mut self, other: MontyFieldElement<MOD, LIMBS>)
-= operation. Read moreSource§impl<'a, MOD, const LIMBS: usize> Sum<&'a MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
impl<'a, MOD, const LIMBS: usize> Sum<&'a MontyFieldElement<MOD, LIMBS>> for MontyFieldElement<MOD, LIMBS>where
MOD: MontyFieldParams<LIMBS>,
Source§fn sum<I: Iterator<Item = &'a MontyFieldElement<MOD, LIMBS>>>(iter: I) -> Self
fn sum<I: Iterator<Item = &'a MontyFieldElement<MOD, LIMBS>>>(iter: I) -> Self
Self from the elements by “summing up”
the items.