ScalarCore

Struct ScalarCore 

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

Trait Implementations§

Source§

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

Source§

type Output = ScalarCore

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add for ScalarCore

Source§

type Output = ScalarCore

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

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

Performs the += operation. Read more
Source§

impl AddAssign for ScalarCore

Source§

fn add_assign(&mut self, other: ScalarCore)

Performs the += operation. Read more
Source§

impl Clone for ScalarCore

Source§

fn clone(&self) -> ScalarCore

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 ScalarCore

Source§

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

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 ScalarCore

Source§

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

Source§

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

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

impl Default for ScalarCore

Source§

fn default() -> ScalarCore

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

impl Field for ScalarCore

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 ScalarCore> for ScalarCoreRepr

Source§

fn from(e: &'a ScalarCore) -> ScalarCoreRepr

Converts to this type from the input type.
Source§

impl From<ScalarCore> for ScalarCoreRepr

Source§

fn from(e: ScalarCore) -> ScalarCoreRepr

Converts to this type from the input type.
Source§

impl From<u64> for ScalarCore

Source§

fn from(val: u64) -> ScalarCore

Converts to this type from the input type.
Source§

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

Source§

type Output = ScalarCore

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul for ScalarCore

Source§

type Output = ScalarCore

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

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

Performs the *= operation. Read more
Source§

impl MulAssign for ScalarCore

Source§

fn mul_assign(&mut self, other: ScalarCore)

Performs the *= operation. Read more
Source§

impl Neg for ScalarCore

Source§

type Output = ScalarCore

The resulting type after applying the - operator.
Source§

fn neg(self) -> ScalarCore

Performs the unary - operation. Read more
Source§

impl Ord for ScalarCore

Elements are ordered lexicographically.

Source§

fn cmp(&self, other: &ScalarCore) -> 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 ScalarCore

Source§

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

Source§

fn partial_cmp(&self, other: &ScalarCore) -> 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 ScalarCore

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 = 1u32

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 = ScalarCoreRepr

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

fn from_repr(r: ScalarCoreRepr) -> CtOption<ScalarCore>

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: ScalarCoreRepr) -> Option<ScalarCore>

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) -> ScalarCoreRepr

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<ScalarCore>> Product<T> for ScalarCore

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 ScalarCore> for ScalarCore

Source§

type Output = ScalarCore

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub for ScalarCore

Source§

type Output = ScalarCore

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

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

Performs the -= operation. Read more
Source§

impl SubAssign for ScalarCore

Source§

fn sub_assign(&mut self, other: ScalarCore)

Performs the -= operation. Read more
Source§

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

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 ScalarCore

Source§

impl Eq for ScalarCore

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>,