[][src]Struct jubjub::Fr

pub struct Fr(_);

Represents an element of GF(r).

Methods

impl Fr[src]

pub fn zero() -> Fr[src]

Returns zero, the additive identity.

pub fn one() -> Fr[src]

Returns one, the multiplicative identity.

pub 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 into_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) representation in Fr.

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.

Trait Implementations

impl Copy for Fr[src]

impl Debug 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 PartialEq<Fr> for Fr[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Eq for Fr[src]

impl From<u64> for Fr[src]

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

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<'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> 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, '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> 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> 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 AddAssign<Fr> for Fr[src]

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

impl SubAssign<Fr> for Fr[src]

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

impl MulAssign<Fr> for Fr[src]

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

impl MulAssign<Fr> for ExtendedPoint[src]

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

impl Clone for Fr[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Default for Fr[src]

impl ConstantTimeEq for Fr[src]

impl ConditionallySelectable for Fr[src]

fn conditional_assign(&mut self, other: &Self, choice: Choice)[src]

Conditionally assign other to self, according to choice. Read more

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)[src]

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more

Auto Trait Implementations

impl Send for Fr

impl Sync for Fr

Blanket Implementations

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.

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

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

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

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

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

type Owned = T

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