[][src]Struct jubjub::Fq

pub struct Fq(_);

Represents an element of GF(q).

Methods

impl Fq[src]

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

Returns zero, the additive identity.

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

Returns one, the multiplicative identity.

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

Doubles this field element.

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

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

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

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

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

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

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

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

pub const fn square(&self) -> Fq[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 PartialEq<Fq> for Fq[src]

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

This method tests for !=.

impl Eq for Fq[src]

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

type Output = Fq

The resulting type after applying the + operator.

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

type Output = Fq

The resulting type after applying the + operator.

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

type Output = Fq

The resulting type after applying the + operator.

impl Add<Fq> for Fq[src]

type Output = Fq

The resulting type after applying the + operator.

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

type Output = Fq

The resulting type after applying the - operator.

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

type Output = Fq

The resulting type after applying the - operator.

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

type Output = Fq

The resulting type after applying the - operator.

impl Sub<Fq> for Fq[src]

type Output = Fq

The resulting type after applying the - operator.

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

type Output = Fq

The resulting type after applying the * operator.

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

type Output = Fq

The resulting type after applying the * operator.

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

type Output = Fq

The resulting type after applying the * operator.

impl Mul<Fq> for Fq[src]

type Output = Fq

The resulting type after applying the * operator.

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

type Output = Fq

The resulting type after applying the - operator.

impl Neg for Fq[src]

type Output = Fq

The resulting type after applying the - operator.

impl AddAssign<Fq> for Fq[src]

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

impl SubAssign<Fq> for Fq[src]

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

impl MulAssign<Fq> for Fq[src]

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

impl Debug for Fq[src]

impl From<u64> for Fq[src]

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

impl Copy for Fq[src]

impl Clone for Fq[src]

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

Performs copy-assignment from source. Read more

impl Default for Fq[src]

impl ConstantTimeEq for Fq[src]

impl ConditionallySelectable for Fq[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 Fq

impl Sync for Fq

Blanket Implementations

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> Into<U> for T where
    U: From<T>, 
[src]

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

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.

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

impl<T> BorrowMut<T> 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

The resulting type after obtaining ownership.

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