Trait elliptic_curve::Field[][src]

pub trait Field: 'static + Eq + Copy + Clone + Default + Send + Sync + Debug + ConditionallySelectable + Add<Self, Output = Self, Output = Self> + Sub<Self, Output = Self, Output = Self> + Mul<Self, Output = Self, Output = Self> + Neg<Output = Self> + for<'a> Add<&'a Self> + for<'a> Mul<&'a Self> + for<'a> Sub<&'a Self> + MulAssign<Self> + AddAssign<Self> + SubAssign<Self> + for<'a> MulAssign<&'a Self> + for<'a> AddAssign<&'a Self> + for<'a> SubAssign<&'a Self> {
    fn random(rng: impl RngCore) -> Self;
fn zero() -> Self;
fn one() -> Self;
fn is_zero(&self) -> bool;
#[must_use] fn square(&self) -> Self;
#[must_use] fn double(&self) -> Self;
fn invert(&self) -> CtOption<Self>;
fn sqrt(&self) -> CtOption<Self>; #[must_use] fn cube(&self) -> Self { ... }
fn pow_vartime<S>(&self, exp: S) -> Self
    where
        S: AsRef<[u64]>
, { ... } }
Expand description

This trait represents an element of a field.

Required methods

fn random(rng: impl RngCore) -> Self[src]

Expand description

Returns an element chosen uniformly at random using a user-provided RNG.

fn zero() -> Self[src]

Expand description

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

fn one() -> Self[src]

Expand description

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

fn is_zero(&self) -> bool[src]

Expand description

Returns true iff this element is zero.

#[must_use]
fn square(&self) -> Self
[src]

Expand description

Squares this element.

#[must_use]
fn double(&self) -> Self
[src]

Expand description

Doubles this element.

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

Expand description

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

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

Expand description

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

Provided methods

#[must_use]
fn cube(&self) -> Self
[src]

Expand description

Cubes this element.

fn pow_vartime<S>(&self, exp: S) -> Self where
    S: AsRef<[u64]>, 
[src]

Expand description

Exponentiates self by exp, where exp 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.

Implementors