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]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
;
#[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.

Returns self + self.

Doubles self in place.

Returns self * self.

Squares self in place.

Computes the multiplicative inverse of self if self is nonzero.

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.

Returns a field element 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.

Implementors