Struct poseidon_rs::Fr

source ·
pub struct Fr(_);

Trait Implementations§

source§

impl Clone for Fr

source§

fn clone(&self) -> Fr

Returns a copy 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 Debug for Fr

source§

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

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

impl Default for Fr

source§

fn default() -> Self

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

impl Display for Fr

source§

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

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

impl Field for Fr

source§

fn zero() -> Self

Returns the zero element of the field, the additive identity.
source§

fn one() -> Self

Returns the one element of the field, the multiplicative identity.
source§

fn is_zero(&self) -> bool

Returns true iff this element is zero.
source§

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

Adds another element to this element.
source§

fn double(&mut self)

Doubles this element.
source§

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

Subtracts another element from this element.
source§

fn negate(&mut self)

Negates this element.
source§

fn inverse(&self) -> Option<Self>

Computes the multiplicative inverse of this element, if nonzero.
source§

fn frobenius_map(&mut self, _: usize)

Exponentiates this element by a power of the base prime modulus via the Frobenius automorphism.
source§

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

Multiplies another element by this element.
source§

fn square(&mut self)

Squares this element.
source§

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

Exponentiates this element by a number represented with u64 limbs, least significant digit first.
source§

impl From<Fr> for FrRepr

source§

fn from(e: Fr) -> FrRepr

Converts to this type from the input type.
source§

impl Hash for Fr

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for Fr

Elements are ordered lexicographically.

source§

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

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

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

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

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

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

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

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

impl PartialEq<Fr> for Fr

source§

fn eq(&self, other: &Fr) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Fr> for Fr

source§

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

This method 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

This method 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

This method 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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PrimeField for Fr

§

type Repr = FrRepr

The prime field can be converted back and forth into this biginteger representation.
source§

fn from_repr(r: FrRepr) -> Result<Fr, PrimeFieldDecodingError>

Convert this prime field element into a biginteger representation.
source§

fn from_raw_repr(r: FrRepr) -> Result<Self, PrimeFieldDecodingError>

Creates an element from raw representation in Montgommery form.
source§

fn into_repr(&self) -> FrRepr

Convert a biginteger representation into a prime field element, if the number is an element of the field.
source§

fn into_raw_repr(&self) -> FrRepr

Expose Montgommery represendation.
source§

fn char() -> FrRepr

Returns the field characteristic; the modulus.
source§

const NUM_BITS: u32 = 254u32

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

const CAPACITY: u32 = 253u32

How many bits of information can be reliably stored in the field element.
source§

fn multiplicative_generator() -> Self

Returns the multiplicative generator of char() - 1 order. This element must also be quadratic nonresidue.
source§

const S: u32 = 28u32

2^s * t = char() - 1 with t odd.
source§

fn root_of_unity() -> Self

Returns the 2^s root of unity computed by exponentiating the multiplicative_generator() by t.
source§

fn from_str(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.
source§

impl Rand for Fr

source§

fn rand<R: Rng>(rng: &mut R) -> Self

Computes a uniformly random element using rejection sampling.

source§

impl SqrtField for Fr

source§

fn legendre(&self) -> LegendreSymbol

Returns the Legendre symbol of the field element.
source§

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

Returns the square root of the field element, if it is quadratic residue.
source§

impl Copy for Fr

source§

impl Eq for Fr

Auto Trait Implementations§

§

impl RefUnwindSafe for Fr

§

impl Send for Fr

§

impl Sync for Fr

§

impl Unpin for Fr

§

impl UnwindSafe for Fr

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. 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 Twhere 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> ToOwned for Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.