Trait ff::Field [−][src]
pub trait Field: Sized + Eq + Copy + Clone + Default + Send + Sync + Debug + 'static + ConditionallySelectable + Add<Output = Self> + Sub<Output = Self> + Mul<Output = Self> + Neg<Output = Self> + for<'a> Add<&'a Self, Output = Self> + for<'a> Mul<&'a Self, Output = Self> + for<'a> Sub<&'a Self, Output = Self> + MulAssign + AddAssign + SubAssign + 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; fn square(&self) -> Self; fn double(&self) -> Self; fn invert(&self) -> CtOption<Self>; fn sqrt(&self) -> CtOption<Self>; fn cube(&self) -> Self { ... } fn pow_vartime<S: AsRef<[u64]>>(&self, exp: S) -> Self { ... } }
Expand description
This trait represents an element of a field.
Required methods
Returns an element chosen uniformly at random using a user-provided RNG.
Computes the multiplicative inverse of this element, failing if the element is zero.
Provided methods
fn pow_vartime<S: AsRef<[u64]>>(&self, exp: S) -> Self
fn pow_vartime<S: AsRef<[u64]>>(&self, exp: S) -> Self
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.