pub trait IsPrimeField: IsField {
    type RepresentativeType: IsUnsignedInteger;

    // Required methods
    fn representative(a: &Self::BaseType) -> Self::RepresentativeType;
    fn from_hex(hex_string: &str) -> Result<Self::BaseType, CreationError>;
    fn field_bit_size() -> usize;

    // Provided methods
    fn modulus_minus_one() -> Self::RepresentativeType { ... }
    fn legendre_symbol(a: &Self::BaseType) -> LegendreSymbol { ... }
    fn sqrt(a: &Self::BaseType) -> Option<(Self::BaseType, Self::BaseType)> { ... }
}

Required Associated Types§

Required Methods§

source

fn representative(a: &Self::BaseType) -> Self::RepresentativeType

Returns the integer representative in the range [0, p-1], where p the modulus

source

fn from_hex(hex_string: &str) -> Result<Self::BaseType, CreationError>

Creates a BaseType from a Hex String 0x is optional Returns an CreationError::InvalidHexStringif the value is not a hexstring

source

fn field_bit_size() -> usize

Returns the number of bits of the max element of the field, as per field documentation, not internal representation. This is log2(max FE) rounded up

Provided Methods§

source

fn modulus_minus_one() -> Self::RepresentativeType

source

fn legendre_symbol(a: &Self::BaseType) -> LegendreSymbol

source

fn sqrt(a: &Self::BaseType) -> Option<(Self::BaseType, Self::BaseType)>

Returns the two square roots of self if they exist and None otherwise

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<M, const NUM_LIMBS: usize> IsPrimeField for MontgomeryBackendPrimeField<M, NUM_LIMBS>where M: IsModulus<UnsignedInteger<NUM_LIMBS>> + Clone + Debug,

source§

impl<const MODULUS: u32> IsPrimeField for U32Field<MODULUS>

source§

impl<const MODULUS: u64> IsPrimeField for U64PrimeField<MODULUS>

source§

impl<const MODULUS: u64> IsPrimeField for U64Field<MODULUS>