pub trait Field:
Sized
+ Eq
+ Copy
+ Clone
+ Default
+ Send
+ Sync
+ Debug
+ Display
+ Hash
+ 'static
+ Neg<Output = Self>
+ Add<Output = Self>
+ Sub<Output = Self>
+ Mul<Output = Self>
+ Sum
+ Product
+ for<'a> Add<&'a Self, Output = Self>
+ for<'a> Sub<&'a Self, Output = Self>
+ for<'a> Mul<&'a Self, Output = Self>
+ for<'a> Sum<&'a Self>
+ for<'a> Product<&'a Self>
+ AddAssign
+ SubAssign
+ MulAssign
+ for<'a> AddAssign<&'a Self>
+ for<'a> SubAssign<&'a Self>
+ for<'a> MulAssign<&'a Self>
+ Square
+ InvertOrZero
+ WithUnderlier<Underlier: PackScalar<Self>> {
const ZERO: Self;
const ONE: Self;
// Required methods
fn random(rng: impl RngCore) -> Self;
fn double(&self) -> Self;
// Provided methods
fn is_zero(&self) -> bool { ... }
fn invert(&self) -> Option<Self> { ... }
fn pow<S: AsRef<[u64]>>(&self, exp: S) -> Self { ... }
fn pow_vartime<S: AsRef<[u64]>>(&self, exp: S) -> Self { ... }
}
Expand description
This trait is based on ff::Field
with some unused functionality removed.
Required Associated Constants§
Required Methods§
Provided Methods§
sourcefn invert(&self) -> Option<Self>
fn invert(&self) -> Option<Self>
Computes the multiplicative inverse of this element, failing if the element is zero.
sourcefn pow<S: AsRef<[u64]>>(&self, exp: S) -> Self
fn pow<S: AsRef<[u64]>>(&self, exp: S) -> Self
Exponentiates self
by exp
, where exp
is a little-endian order integer
exponent.
§Guarantees
This operation is constant time with respect to self
, for all exponents with the
same number of digits (exp.as_ref().len()
). It is variable time with respect to
the number of digits in the exponent.
sourcefn 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.
§Guarantees
This operation is variable time with respect to self
, for all exponent. If
the exponent is fixed, this operation is effectively constant time. However, for
stronger constant-time guarantees, Field::pow
should be used.
Object Safety§
This trait is not object safe.