[−][src]Trait ff::PrimeField
This represents an element of a prime field.
Associated Types
type Repr: Default + AsRef<[u8]> + AsMut<[u8]> + From<Self> + for<'r> From<&'r Self>
The prime field can be converted back and forth into this binary representation.
type ReprEndianness: Endianness
This indicates the endianness of PrimeField::Repr.
Associated Constants
const NUM_BITS: u32
How many bits are needed to represent an element of this field.
const CAPACITY: u32
How many bits of information can be reliably stored in the field element.
const S: u32
2^s * t = char() - 1 with t odd.
Required methods
fn from_repr(_: Self::Repr) -> Option<Self>
Attempts to convert a byte representation of a field element into an element of this prime field, failing if the input is not canonical (is not smaller than the field's modulus).
The byte representation is interpreted with the endianness defined by
PrimeField::ReprEndianness.
fn to_repr(&self) -> Self::Repr
Converts an element of the prime field into the standard byte representation for this field.
The endianness of the byte representation is defined by
PrimeField::ReprEndianness.
fn is_odd(&self) -> bool
Returns true iff this element is odd.
fn char() -> Self::Repr
Returns the field characteristic; the modulus.
fn multiplicative_generator() -> Self
Returns the multiplicative generator of char() - 1 order. This element
must also be quadratic nonresidue.
fn root_of_unity() -> Self
Returns the 2^s root of unity computed by exponentiating the multiplicative_generator()
by t.
Provided methods
fn from_str(s: &str) -> Option<Self>
Interpret a string of numbers as a (congruent) prime field element. Does not accept unnecessary leading zeroes or a blank string.
fn is_even(&self) -> bool
Returns true iff this element is even.