Trait ff_ce::PrimeField
source · pub trait PrimeField: Field {
type Repr: PrimeFieldRepr + From<Self>;
const NUM_BITS: u32;
const CAPACITY: u32;
const S: u32;
fn from_repr(repr: Self::Repr) -> Result<Self, PrimeFieldDecodingError>;
fn from_raw_repr(repr: Self::Repr) -> Result<Self, PrimeFieldDecodingError>;
fn into_repr(&self) -> Self::Repr;
fn into_raw_repr(&self) -> Self::Repr;
fn char() -> Self::Repr;
fn multiplicative_generator() -> Self;
fn root_of_unity() -> Self;
fn from_str(s: &str) -> Option<Self> { ... }
}
Expand description
This represents an element of a prime field.
Required Associated Types§
sourcetype Repr: PrimeFieldRepr + From<Self>
type Repr: PrimeFieldRepr + From<Self>
The prime field can be converted back and forth into this biginteger representation.
Required Associated Constants§
Required Methods§
sourcefn from_repr(repr: Self::Repr) -> Result<Self, PrimeFieldDecodingError>
fn from_repr(repr: Self::Repr) -> Result<Self, PrimeFieldDecodingError>
Convert this prime field element into a biginteger representation.
sourcefn from_raw_repr(repr: Self::Repr) -> Result<Self, PrimeFieldDecodingError>
fn from_raw_repr(repr: Self::Repr) -> Result<Self, PrimeFieldDecodingError>
Creates an element from raw representation in Montgommery form.
sourcefn into_repr(&self) -> Self::Repr
fn into_repr(&self) -> Self::Repr
Convert a biginteger representation into a prime field element, if the number is an element of the field.
sourcefn into_raw_repr(&self) -> Self::Repr
fn into_raw_repr(&self) -> Self::Repr
Expose Montgommery represendation.
sourcefn multiplicative_generator() -> Self
fn multiplicative_generator() -> Self
Returns the multiplicative generator of char()
- 1 order. This element
must also be quadratic nonresidue.
sourcefn root_of_unity() -> Self
fn root_of_unity() -> Self
Returns the 2^s root of unity computed by exponentiating the multiplicative_generator()
by t.