[][src]Trait elliptic_curve::Field

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

This trait represents an element of a field.

Required methods

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

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

pub fn zero() -> Self[src]

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

pub fn one() -> Self[src]

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

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

Returns true iff this element is zero.

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

Squares this element.

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

Doubles this element.

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

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

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

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

Loading content...

Provided methods

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

Cubes this element.

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

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.

Loading content...

Implementors

Loading content...