Trait lambdaworks_math::field::traits::IsPrimeField
source · 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 to_hex(a: &Self::BaseType) -> String;
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§
sourcefn representative(a: &Self::BaseType) -> Self::RepresentativeType
fn representative(a: &Self::BaseType) -> Self::RepresentativeType
Returns the integer representative in the range [0, p-1], where p the modulus
sourcefn from_hex(hex_string: &str) -> Result<Self::BaseType, CreationError>
fn from_hex(hex_string: &str) -> Result<Self::BaseType, CreationError>
Creates a BaseType from a Hex String
0x is optional
Returns an CreationError::InvalidHexString
if the value is not a hexstring
sourcefn field_bit_size() -> usize
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§
fn modulus_minus_one() -> Self::RepresentativeType
fn legendre_symbol(a: &Self::BaseType) -> LegendreSymbol
Object Safety§
This trait is not object safe.