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

fn characteristic<'a>() -> &'a [u64]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

Returns the characteristic of the field.

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

Returns self + self.

fn double_in_place(&mut self) -> &mut Self[src]

Doubles self in place.

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

Returns self * self.

fn square_in_place(&mut self) -> &mut Self[src]

Squares self in place.

#[must_use]
fn inverse(&self) -> Option<Self>
[src]

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]

Exponentiates this element by a power of the base prime modulus via the Frobenius automorphism.

fn from_random_bytes_with_flags(bytes: &[u8]) -> Option<(Self, u8)>[src]

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

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

Exponentiates this element by a number represented with u64 limbs, least significant limb first.

fn from_random_bytes(bytes: &[u8]) -> Option<Self>[src]

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

impl<P> Field for snarkvm_wasm::fp6_2over3::Fp6<P> where
    P: Fp6Parameters
[src]

pub fn characteristic<'a>() -> &'a [u64]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

pub fn double(&self) -> Fp6<P>[src]

pub fn double_in_place(&mut self) -> &mut Fp6<P>[src]

pub fn square(&self) -> Fp6<P>[src]

pub fn from_random_bytes_with_flags(bytes: &[u8]) -> Option<(Fp6<P>, u8)>[src]

pub fn from_random_bytes(bytes: &[u8]) -> Option<Fp6<P>>[src]

pub fn square_in_place(&mut self) -> &mut Fp6<P>[src]

pub fn inverse(&self) -> Option<Fp6<P>>[src]

pub fn inverse_in_place(&mut self) -> Option<&mut Fp6<P>>[src]

pub fn frobenius_map(&mut self, power: usize)[src]

impl<P> Field for snarkvm_wasm::fp6_3over2::Fp6<P> where
    P: Fp6Parameters
[src]

pub fn characteristic<'a>() -> &'a [u64]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

pub fn double(&self) -> Fp6<P>[src]

pub fn double_in_place(&mut self) -> &mut Fp6<P>[src]

pub fn from_random_bytes_with_flags(bytes: &[u8]) -> Option<(Fp6<P>, u8)>[src]

pub fn from_random_bytes(bytes: &[u8]) -> Option<Fp6<P>>[src]

pub fn square(&self) -> Fp6<P>[src]

pub fn square_in_place(&mut self) -> &mut Fp6<P>[src]

pub fn inverse(&self) -> Option<Fp6<P>>[src]

pub fn inverse_in_place(&mut self) -> Option<&mut Fp6<P>>[src]

pub fn frobenius_map(&mut self, power: usize)[src]

impl<P> Field for Fp2<P> where
    P: Fp2Parameters
[src]

pub fn characteristic<'a>() -> &'a [u64]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

pub fn double(&self) -> Fp2<P>[src]

pub fn double_in_place(&mut self) -> &mut Fp2<P>[src]

pub fn square(&self) -> Fp2<P>[src]

pub fn from_random_bytes_with_flags(bytes: &[u8]) -> Option<(Fp2<P>, u8)>[src]

pub fn from_random_bytes(bytes: &[u8]) -> Option<Fp2<P>>[src]

pub fn square_in_place(&mut self) -> &mut Fp2<P>[src]

pub fn inverse(&self) -> Option<Fp2<P>>[src]

pub fn inverse_in_place(&mut self) -> Option<&mut Fp2<P>>[src]

pub fn frobenius_map(&mut self, power: usize)[src]

impl<P> Field for Fp3<P> where
    P: Fp3Parameters
[src]

pub fn characteristic<'a>() -> &'a [u64]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

pub fn double(&self) -> Fp3<P>[src]

pub fn double_in_place(&mut self) -> &mut Fp3<P>[src]

pub fn from_random_bytes_with_flags(bytes: &[u8]) -> Option<(Fp3<P>, u8)>[src]

pub fn from_random_bytes(bytes: &[u8]) -> Option<Fp3<P>>[src]

pub fn square(&self) -> Fp3<P>[src]

pub fn square_in_place(&mut self) -> &mut Fp3<P>[src]

pub fn inverse(&self) -> Option<Fp3<P>>[src]

pub fn inverse_in_place(&mut self) -> Option<&mut Fp3<P>>[src]

pub fn frobenius_map(&mut self, power: usize)[src]

impl<P> Field for Fp12<P> where
    P: Fp12Parameters
[src]

pub fn characteristic<'a>() -> &'a [u64]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

pub fn double(&self) -> Fp12<P>[src]

pub fn from_random_bytes_with_flags(bytes: &[u8]) -> Option<(Fp12<P>, u8)>[src]

pub fn from_random_bytes(bytes: &[u8]) -> Option<Fp12<P>>[src]

pub fn double_in_place(&mut self) -> &mut Fp12<P>[src]

pub fn frobenius_map(&mut self, power: usize)[src]

pub fn square(&self) -> Fp12<P>[src]

pub fn square_in_place(&mut self) -> &mut Fp12<P>[src]

pub fn inverse(&self) -> Option<Fp12<P>>[src]

pub fn inverse_in_place(&mut self) -> Option<&mut Fp12<P>>[src]

impl<P> Field for Fp256<P> where
    P: Fp256Parameters
[src]

pub fn from_random_bytes_with_flags(bytes: &[u8]) -> Option<(Fp256<P>, u8)>[src]

pub fn double(&self) -> Fp256<P>[src]

pub fn double_in_place(&mut self) -> &mut Fp256<P>[src]

pub fn characteristic<'a>() -> &'a [u64]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

pub fn square(&self) -> Fp256<P>[src]

pub fn square_in_place(&mut self) -> &mut Fp256<P>[src]

pub fn inverse(&self) -> Option<Fp256<P>>[src]

pub fn inverse_in_place(&mut self) -> Option<&mut Fp256<P>>[src]

pub fn frobenius_map(&mut self, usize)[src]

impl<P> Field for Fp320<P> where
    P: Fp320Parameters
[src]

pub fn from_random_bytes_with_flags(bytes: &[u8]) -> Option<(Fp320<P>, u8)>[src]

pub fn double(&self) -> Fp320<P>[src]

pub fn double_in_place(&mut self) -> &mut Fp320<P>[src]

pub fn characteristic<'a>() -> &'a [u64]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

pub fn square(&self) -> Fp320<P>[src]

pub fn square_in_place(&mut self) -> &mut Fp320<P>[src]

pub fn inverse(&self) -> Option<Fp320<P>>[src]

pub fn inverse_in_place(&mut self) -> Option<&mut Fp320<P>>[src]

pub fn frobenius_map(&mut self, usize)[src]

impl<P> Field for Fp384<P> where
    P: Fp384Parameters
[src]

pub fn from_random_bytes_with_flags(bytes: &[u8]) -> Option<(Fp384<P>, u8)>[src]

pub fn double(&self) -> Fp384<P>[src]

pub fn double_in_place(&mut self) -> &mut Fp384<P>[src]

pub fn characteristic<'a>() -> &'a [u64]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

pub fn square(&self) -> Fp384<P>[src]

pub fn square_in_place(&mut self) -> &mut Fp384<P>[src]

pub fn inverse(&self) -> Option<Fp384<P>>[src]

pub fn inverse_in_place(&mut self) -> Option<&mut Fp384<P>>[src]

pub fn frobenius_map(&mut self, usize)[src]

impl<P> Field for Fp768<P> where
    P: Fp768Parameters
[src]

pub fn from_random_bytes_with_flags(bytes: &[u8]) -> Option<(Fp768<P>, u8)>[src]

pub fn double(&self) -> Fp768<P>[src]

pub fn double_in_place(&mut self) -> &mut Fp768<P>[src]

pub fn characteristic<'a>() -> &'a [u64]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

pub fn square(&self) -> Fp768<P>[src]

pub fn square_in_place(&mut self) -> &mut Fp768<P>[src]

pub fn inverse(&self) -> Option<Fp768<P>>[src]

pub fn inverse_in_place(&mut self) -> Option<&mut Fp768<P>>[src]

pub fn frobenius_map(&mut self, usize)[src]

impl<P> Field for Fp832<P> where
    P: Fp832Parameters
[src]

pub fn from_random_bytes_with_flags(bytes: &[u8]) -> Option<(Fp832<P>, u8)>[src]

pub fn double(&self) -> Fp832<P>[src]

pub fn double_in_place(&mut self) -> &mut Fp832<P>[src]

pub fn characteristic<'a>() -> &'a [u64]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

pub fn square(&self) -> Fp832<P>[src]

pub fn square_in_place(&mut self) -> &mut Fp832<P>[src]

pub fn inverse(&self) -> Option<Fp832<P>>[src]

pub fn inverse_in_place(&mut self) -> Option<&mut Fp832<P>>[src]

pub fn frobenius_map(&mut self, usize)[src]