pub trait _: FftField<FftParameters = Self::Parameters> + PoseidonDefaultField + FromStr<Err = FieldError> {
    type Parameters: FieldParameters<BigInteger = Self::BigInteger>;
    type BigInteger: BigInteger;

    const SIZE_IN_BITS: usize = <Self::Parameters>::MODULUS_BITS as usize;
    const SIZE_IN_DATA_BITS: usize = <Self::Parameters>::CAPACITY as usize;

    // Required methods
    fn from_bigint(repr: Self::BigInteger) -> Option<Self>;
    fn to_bigint(&self) -> Self::BigInteger;
    fn decompose(
        &self,
        q1: &[u64; 4],
        q2: &[u64; 4],
        b1: Self,
        b2: Self,
        r128: Self,
        half_r: &[u64; 8]
    ) -> (Self, Self, bool, bool);

    // Provided methods
    fn size_in_bits() -> usize { ... }
    fn size_in_data_bits() -> usize { ... }
    fn modulus() -> Self::BigInteger { ... }
    fn modulus_minus_one_div_two() -> Self::BigInteger { ... }
    fn trace() -> Self::BigInteger { ... }
    fn trace_minus_one_div_two() -> Self::BigInteger { ... }
    fn from_bytes_be_mod_order(bytes: &[u8]) -> Self { ... }
    fn from_bytes_le_mod_order(bytes: &[u8]) -> Self { ... }
}
Expand description

The interface for a prime field.

Required Associated Types§

type Parameters: FieldParameters<BigInteger = Self::BigInteger>

type BigInteger: BigInteger

Provided Associated Constants§

const SIZE_IN_BITS: usize = <Self::Parameters>::MODULUS_BITS as usize

Returns the field size in bits.

const SIZE_IN_DATA_BITS: usize = <Self::Parameters>::CAPACITY as usize

Returns the field capacity for data bits.

Required Methods§

fn from_bigint(repr: Self::BigInteger) -> Option<Self>

Constructs a PrimeField element given a human-readable Self::BigInteger.

fn to_bigint(&self) -> Self::BigInteger

Returns a human-readable Self::BigInteger in the range 0..(Self::MODULUS - 1).

fn decompose( &self, q1: &[u64; 4], q2: &[u64; 4], b1: Self, b2: Self, r128: Self, half_r: &[u64; 8] ) -> (Self, Self, bool, bool)

Returns the decomposition of the scalar.

Provided Methods§

fn size_in_bits() -> usize

Returns the field size in bits.

fn size_in_data_bits() -> usize

Returns the capacity size for data bits.

fn modulus() -> Self::BigInteger

Returns the modulus.

fn modulus_minus_one_div_two() -> Self::BigInteger

Returns the modulus minus one divided by two.

fn trace() -> Self::BigInteger

Returns the trace.

fn trace_minus_one_div_two() -> Self::BigInteger

Returns the trace minus one divided by two.

fn from_bytes_be_mod_order(bytes: &[u8]) -> Self

Reads bytes in big-endian, and converts them to a field element. If the bytes are larger than the modulus, it will reduce them.

fn from_bytes_le_mod_order(bytes: &[u8]) -> Self

Reads bytes in little-endian, and converts them to a field element. If the bytes are larger than the modulus, it will reduce them.

Implementors§

§

impl<P> PrimeField for Fp256<P>where P: Fp256Parameters,

§

impl<P> PrimeField for Fp384<P>where P: Fp384Parameters,

ils class="toggle method-toggle" open>

fn inverse_in_place(&mut self) -> Option<&mut Self>

Sets self to self’s inverse if it exists. Otherwise it is a no-op.

fn frobenius_map(&mut self, power: usize)

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

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

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 half() -> Self

Returns the constant 2^{-1}.

fn sum_of_products<'a>( a: impl Iterator<Item = &'a Self> + Clone, b: impl Iterator<Item = &'a Self> + Clone ) -> Self

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

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

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

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 Fp2<P>where P: Fp2Parameters,

§

type BasePrimeField = <P as Fp2Parameters>::Fp

§

impl<P> Field for Fp6<P>where P: Fp6Parameters,

§

type BasePrimeField = <Fp2<<P as Fp6Parameters>::Fp2Params> as Field>::BasePrimeField

§

impl<P> Field for Fp12<P>where P: Fp12Parameters,

§

type BasePrimeField = <Fp6<<P as Fp12Parameters>::Fp6Params> as Field>::BasePrimeField

§

impl<P> Field for Fp256<P>where P: Fp256Parameters,

§

type BasePrimeField = Fp256<P>

§

impl<P> Field for Fp384<P>where P: Fp384Parameters,

§

type BasePrimeField = Fp384<P>