FieldElementCore

Struct FieldElementCore 

Source
pub struct FieldElementCore(/* private fields */);

Trait Implementations§

Source§

impl<'r> Add<&'r FieldElementCore> for FieldElementCore

Source§

type Output = FieldElementCore

The resulting type after applying the + operator.
Source§

fn add(self, other: &FieldElementCore) -> FieldElementCore

Performs the + operation. Read more
Source§

impl Add for FieldElementCore

Source§

type Output = FieldElementCore

The resulting type after applying the + operator.
Source§

fn add(self, other: FieldElementCore) -> Self

Performs the + operation. Read more
Source§

impl<'r> AddAssign<&'r FieldElementCore> for FieldElementCore

Source§

fn add_assign(&mut self, other: &FieldElementCore)

Performs the += operation. Read more
Source§

impl AddAssign for FieldElementCore

Source§

fn add_assign(&mut self, other: FieldElementCore)

Performs the += operation. Read more
Source§

impl Clone for FieldElementCore

Source§

fn clone(&self) -> FieldElementCore

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 ConditionallySelectable for FieldElementCore

Source§

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

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 ConstantTimeEq for FieldElementCore

Source§

fn ct_eq(&self, other: &FieldElementCore) -> 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 Debug for FieldElementCore

Source§

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

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

impl Default for FieldElementCore

Source§

fn default() -> FieldElementCore

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

impl Field for FieldElementCore

Source§

fn random(rng: impl RngCore) -> Self

Computes a uniformly random element using rejection sampling.

Source§

const ZERO: Self

The zero element of the field, the additive identity.
Source§

const ONE: Self = R

The one element of the field, the multiplicative identity.
Source§

fn is_zero_vartime(&self) -> bool

Returns true iff this element is zero. Read more
Source§

fn double(&self) -> Self

Doubles this element.
Source§

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

Computes the multiplicative inverse of this element, failing if the element is zero.
Source§

fn square(&self) -> Self

Squares this element.
Source§

fn sqrt_ratio(num: &Self, div: &Self) -> (Choice, Self)

Computes: Read more
Source§

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

Returns the square root of the field element, if it is quadratic residue. Read more
Source§

fn is_zero(&self) -> Choice

Returns true iff this element is zero.
Source§

fn cube(&self) -> Self

Cubes this element.
Source§

fn sqrt_alt(&self) -> (Choice, Self)

Equivalent to Self::sqrt_ratio(self, one()). Read more
Source§

fn pow<S>(&self, exp: S) -> Self
where S: AsRef<[u64]>,

Exponentiates self by exp, where exp is a little-endian order integer exponent. Read more
Source§

fn pow_vartime<S>(&self, exp: S) -> Self
where S: AsRef<[u64]>,

Exponentiates self by exp, where exp is a little-endian order integer exponent. Read more
Source§

impl<'a> From<&'a FieldElementCore> for FieldElementCoreRepr

Source§

fn from(e: &'a FieldElementCore) -> FieldElementCoreRepr

Converts to this type from the input type.
Source§

impl From<FieldElementCore> for FieldElementCoreRepr

Source§

fn from(e: FieldElementCore) -> FieldElementCoreRepr

Converts to this type from the input type.
Source§

impl From<u64> for FieldElementCore

Source§

fn from(val: u64) -> FieldElementCore

Converts to this type from the input type.
Source§

impl<'r> Mul<&'r FieldElementCore> for FieldElementCore

Source§

type Output = FieldElementCore

The resulting type after applying the * operator.
Source§

fn mul(self, other: &FieldElementCore) -> Self

Performs the * operation. Read more
Source§

impl Mul for FieldElementCore

Source§

type Output = FieldElementCore

The resulting type after applying the * operator.
Source§

fn mul(self, other: FieldElementCore) -> Self

Performs the * operation. Read more
Source§

impl<'r> MulAssign<&'r FieldElementCore> for FieldElementCore

Source§

fn mul_assign(&mut self, other: &FieldElementCore)

Performs the *= operation. Read more
Source§

impl MulAssign for FieldElementCore

Source§

fn mul_assign(&mut self, other: FieldElementCore)

Performs the *= operation. Read more
Source§

impl Neg for FieldElementCore

Source§

type Output = FieldElementCore

The resulting type after applying the - operator.
Source§

fn neg(self) -> FieldElementCore

Performs the unary - operation. Read more
Source§

impl Ord for FieldElementCore

Elements are ordered lexicographically.

Source§

fn cmp(&self, other: &FieldElementCore) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for FieldElementCore

Source§

fn eq(&self, other: &FieldElementCore) -> 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 PartialOrd for FieldElementCore

Source§

fn partial_cmp(&self, other: &FieldElementCore) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PrimeField for FieldElementCore

Source§

const MODULUS: &'static str = MODULUS_STR

Modulus of the field written as a string for debugging purposes. Read more
Source§

const NUM_BITS: u32 = 252u32

How many bits are needed to represent an element of this field.
Source§

const CAPACITY: u32 = 251u32

How many bits of information can be reliably stored in the field element. Read more
Source§

const TWO_INV: Self = TWO_INV

Inverse of $2$ in the field.
Source§

const MULTIPLICATIVE_GENERATOR: Self = GENERATOR

A fixed multiplicative generator of modulus - 1 order. This element must also be a quadratic nonresidue. Read more
Source§

const S: u32 = 192u32

An integer s satisfying the equation 2^s * t = modulus - 1 with t odd. Read more
Source§

const ROOT_OF_UNITY: Self = ROOT_OF_UNITY

The 2^s root of unity. Read more
Source§

const ROOT_OF_UNITY_INV: Self = ROOT_OF_UNITY_INV

Source§

const DELTA: Self = DELTA

Generator of the t-order multiplicative subgroup. Read more
Source§

type Repr = FieldElementCoreRepr

The prime field can be converted back and forth into this binary representation.
Source§

fn from_repr(r: FieldElementCoreRepr) -> CtOption<FieldElementCore>

Attempts to convert a byte representation of a field element into an element of this prime field, failing if the input is not canonical (is not smaller than the field’s modulus). Read more
Source§

fn from_repr_vartime(r: FieldElementCoreRepr) -> Option<FieldElementCore>

Attempts to convert a byte representation of a field element into an element of this prime field, failing if the input is not canonical (is not smaller than the field’s modulus). Read more
Source§

fn to_repr(&self) -> FieldElementCoreRepr

Converts an element of the prime field into the standard byte representation for this field. Read more
Source§

fn is_odd(&self) -> Choice

Returns true iff this element is odd.
Source§

fn from_str_vartime(s: &str) -> Option<Self>

Interpret a string of numbers as a (congruent) prime field element. Does not accept unnecessary leading zeroes or a blank string. Read more
Source§

fn from_u128(v: u128) -> Self

Obtains a field element congruent to the integer v. Read more
Source§

fn is_even(&self) -> Choice

Returns true iff this element is even.
Source§

impl<T: Borrow<FieldElementCore>> Product<T> for FieldElementCore

Source§

fn product<I: Iterator<Item = T>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by multiplying the items.
Source§

impl<'r> Sub<&'r FieldElementCore> for FieldElementCore

Source§

type Output = FieldElementCore

The resulting type after applying the - operator.
Source§

fn sub(self, other: &FieldElementCore) -> Self

Performs the - operation. Read more
Source§

impl Sub for FieldElementCore

Source§

type Output = FieldElementCore

The resulting type after applying the - operator.
Source§

fn sub(self, other: FieldElementCore) -> Self

Performs the - operation. Read more
Source§

impl<'r> SubAssign<&'r FieldElementCore> for FieldElementCore

Source§

fn sub_assign(&mut self, other: &FieldElementCore)

Performs the -= operation. Read more
Source§

impl SubAssign for FieldElementCore

Source§

fn sub_assign(&mut self, other: FieldElementCore)

Performs the -= operation. Read more
Source§

impl<T: Borrow<FieldElementCore>> Sum<T> for FieldElementCore

Source§

fn sum<I: Iterator<Item = T>>(iter: I) -> Self

Takes an iterator and generates Self from the elements by “summing up” the items.
Source§

impl Copy for FieldElementCore

Source§

impl Eq for FieldElementCore

Auto Trait Implementations§

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> 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> Same for T

Source§

type Output = T

Should always be Self
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<T, Rhs, Output> GroupOps<Rhs, Output> for T
where T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + AddAssign<Rhs> + SubAssign<Rhs>,

Source§

impl<T, Rhs, Output> GroupOpsOwned<Rhs, Output> for T
where T: for<'r> GroupOps<&'r Rhs, Output>,

Source§

impl<T, Rhs, Output> ScalarMul<Rhs, Output> for T
where T: Mul<Rhs, Output = Output> + MulAssign<Rhs>,

Source§

impl<T, Rhs, Output> ScalarMulOwned<Rhs, Output> for T
where T: for<'r> ScalarMul<&'r Rhs, Output>,