[][src]Struct jubjub::Fr

pub struct Fr(_);

Represents an element of the scalar field $\mathbb{F}_r$ of the Jubjub elliptic curve construction.

Implementations

impl Fr[src]

pub const fn zero() -> Fr[src]

Returns zero, the additive identity.

pub const fn one() -> Fr[src]

Returns one, the multiplicative identity.

pub const fn double(&self) -> Fr[src]

Doubles this field element.

pub fn from_bytes(bytes: &[u8; 32]) -> CtOption<Fr>[src]

Attempts to convert a little-endian byte representation of a field element into an element of Fr, failing if the input is not canonical (is not smaller than r).

pub fn to_bytes(&self) -> [u8; 32][src]

Converts an element of Fr into a byte representation in little-endian byte order.

pub fn from_bytes_wide(bytes: &[u8; 64]) -> Fr[src]

Converts a 512-bit little endian integer into an element of Fr by reducing modulo r.

pub const fn from_raw(val: [u64; 4]) -> Self[src]

Converts from an integer represented in little endian into its (congruent) Fr representation.

pub const fn square(&self) -> Fr[src]

Squares this element.

pub fn sqrt(&self) -> CtOption<Self>[src]

Computes the square root of this element, if it exists.

pub fn pow(&self, by: &[u64; 4]) -> Self[src]

Exponentiates self by by, where by is a little-endian order integer exponent.

pub fn pow_vartime(&self, by: &[u64; 4]) -> Self[src]

Exponentiates self by by, where by is a little-endian order integer exponent.

This operation is variable time with respect to the exponent. If the exponent is fixed, this operation is effectively constant time.

pub fn invert(&self) -> CtOption<Self>[src]

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

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

Multiplies this element by another element

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

Subtracts another element from this element.

pub const fn add(&self, rhs: &Self) -> Self[src]

Adds this element to another element.

pub const fn neg(&self) -> Self[src]

Negates this element.

Trait Implementations

impl<'a, 'b> Add<&'b Fr> for &'a Fr[src]

type Output = Fr

The resulting type after applying the + operator.

impl<'b> Add<&'b Fr> for Fr[src]

type Output = Fr

The resulting type after applying the + operator.

impl<'a> Add<Fr> for &'a Fr[src]

type Output = Fr

The resulting type after applying the + operator.

impl Add<Fr> for Fr[src]

type Output = Fr

The resulting type after applying the + operator.

impl<'b> AddAssign<&'b Fr> for Fr[src]

impl AddAssign<Fr> for Fr[src]

impl Clone for Fr[src]

impl ConditionallySelectable for Fr[src]

impl ConstantTimeEq for Fr[src]

impl Copy for Fr[src]

impl Debug for Fr[src]

impl Default for Fr[src]

impl Display for Fr[src]

impl Eq for Fr[src]

impl Field for Fr[src]

impl<'a> From<&'a Fr> for [u8; 32][src]

impl From<Fr> for [u8; 32][src]

impl From<u64> for Fr[src]

impl<'a, 'b> Mul<&'b Fr> for &'a Fr[src]

type Output = Fr

The resulting type after applying the * operator.

impl<'b> Mul<&'b Fr> for Fr[src]

type Output = Fr

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b Fr> for &'a SubgroupPoint[src]

type Output = SubgroupPoint

The resulting type after applying the * operator.

impl<'b> Mul<&'b Fr> for SubgroupPoint[src]

type Output = SubgroupPoint

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b Fr> for &'a AffineNielsPoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl<'b> Mul<&'b Fr> for AffineNielsPoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b Fr> for &'a ExtendedNielsPoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl<'b> Mul<&'b Fr> for ExtendedNielsPoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b Fr> for &'a ExtendedPoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl<'b> Mul<&'b Fr> for ExtendedPoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl<'a, 'b> Mul<&'b Fr> for &'a AffinePoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl<'b> Mul<&'b Fr> for AffinePoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl<'a> Mul<Fr> for &'a Fr[src]

type Output = Fr

The resulting type after applying the * operator.

impl Mul<Fr> for Fr[src]

type Output = Fr

The resulting type after applying the * operator.

impl<'a> Mul<Fr> for &'a SubgroupPoint[src]

type Output = SubgroupPoint

The resulting type after applying the * operator.

impl Mul<Fr> for SubgroupPoint[src]

type Output = SubgroupPoint

The resulting type after applying the * operator.

impl<'a> Mul<Fr> for &'a AffineNielsPoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl Mul<Fr> for AffineNielsPoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl<'a> Mul<Fr> for &'a ExtendedNielsPoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl Mul<Fr> for ExtendedNielsPoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl<'a> Mul<Fr> for &'a ExtendedPoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl Mul<Fr> for ExtendedPoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl<'a> Mul<Fr> for &'a AffinePoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl Mul<Fr> for AffinePoint[src]

type Output = ExtendedPoint

The resulting type after applying the * operator.

impl<'b> MulAssign<&'b Fr> for Fr[src]

impl<'b> MulAssign<&'b Fr> for ExtendedPoint[src]

impl<'b> MulAssign<&'b Fr> for SubgroupPoint[src]

impl MulAssign<Fr> for Fr[src]

impl MulAssign<Fr> for ExtendedPoint[src]

impl MulAssign<Fr> for SubgroupPoint[src]

impl<'a> Neg for &'a Fr[src]

type Output = Fr

The resulting type after applying the - operator.

impl Neg for Fr[src]

type Output = Fr

The resulting type after applying the - operator.

impl PartialEq<Fr> for Fr[src]

impl PrimeField for Fr[src]

type Repr = [u8; 32]

The prime field can be converted back and forth into this binary representation. Read more

type ReprBits = [u32; 8]

The backing store for a bit representation of a prime field element.

impl StructuralEq for Fr[src]

impl<'a, 'b> Sub<&'b Fr> for &'a Fr[src]

type Output = Fr

The resulting type after applying the - operator.

impl<'b> Sub<&'b Fr> for Fr[src]

type Output = Fr

The resulting type after applying the - operator.

impl<'a> Sub<Fr> for &'a Fr[src]

type Output = Fr

The resulting type after applying the - operator.

impl Sub<Fr> for Fr[src]

type Output = Fr

The resulting type after applying the - operator.

impl<'b> SubAssign<&'b Fr> for Fr[src]

impl SubAssign<Fr> for Fr[src]

Auto Trait Implementations

impl Send for Fr

impl Sync for Fr

impl Unpin for Fr

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, Rhs, Output> GroupOps<Rhs, Output> for T where
    T: Add<Rhs, Output = Output> + Sub<Rhs, Output = Output> + AddAssign<Rhs> + SubAssign<Rhs>, 
[src]

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

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

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

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.