Trait snarkvm_wasm::Field [−][src]
pub trait Field: 'static + ToBytes + FromBytes + Copy + Clone + Debug + Display + Default + Send + Sync + Eq + One + Ord + Neg<Output = Self> + UniformRand + Hash + From<u128> + From<u64> + From<u32> + From<u16> + From<u8> + for<'a> Add<&'a Self, Output = Self> + for<'a> Sub<&'a Self, Output = Self> + for<'a> Mul<&'a Self, Output = Self> + for<'a> Div<&'a Self, Output = Self> + for<'a> AddAssign<&'a Self> + for<'a> SubAssign<&'a Self> + for<'a> MulAssign<&'a Self> + for<'a> DivAssign<&'a Self> + CanonicalSerialize + ConstantSerializedSize + CanonicalSerializeWithFlags + CanonicalDeserialize + CanonicalDeserializeWithFlags + Serialize + for<'a> Deserialize<'a> + Zero { fn characteristic<'a>() -> &'a [u64]ⓘ; #[must_use] fn double(&self) -> Self; fn double_in_place(&mut self) -> &mut Self; #[must_use] fn square(&self) -> Self; fn square_in_place(&mut self) -> &mut Self; #[must_use] fn inverse(&self) -> Option<Self>; fn inverse_in_place(&mut self) -> Option<&mut Self>; fn frobenius_map(&mut self, power: usize); fn from_random_bytes_with_flags(bytes: &[u8]) -> Option<(Self, u8)>; fn pow<S>(&self, exp: S) -> Self
where
S: AsRef<[u64]>, { ... } fn from_random_bytes(bytes: &[u8]) -> Option<Self> { ... } }
Expand description
The interface for a generic field.
Required methods
Returns the characteristic of the field.
fn double_in_place(&mut self) -> &mut Self
[src]
fn double_in_place(&mut self) -> &mut Self
[src]Doubles self
in place.
fn square_in_place(&mut self) -> &mut Self
[src]
fn square_in_place(&mut self) -> &mut Self
[src]Squares self
in place.
Computes the multiplicative inverse of self
if self
is nonzero.
fn inverse_in_place(&mut self) -> Option<&mut Self>
[src]fn frobenius_map(&mut self, power: usize)
[src]
fn frobenius_map(&mut self, power: usize)
[src]Exponentiates this element by a power of the base prime modulus via the Frobenius automorphism.
Returns a field element with an extra sign bit used for group parsing if the set of bytes forms a valid field element, otherwise returns None. This function is primarily intended for sampling random field elements from a hash-function or RNG output.
Provided methods
Exponentiates this element by a number represented with u64
limbs,
least significant limb first.