pub trait PrimeField: Field {
const MODULUS: &'static str;
const S: usize;
const MULTIPLICATIVE_GENERATOR: Self;
const MINUS_TWO: Self;
const TWO_INV: Self;
const ROOT_OF_UNITY: Self;
const ROOT_OF_UNITY_INV: Self;
const DELTA: Self;
}Expand description
A Field whose order is a prime number.
This kind of field has certain mathematical properties that are very useful in cryptographic applications. Notably, Fermat’s Little Theorem holds.
Required Associated Constants§
Sourceconst MODULUS: &'static str
const MODULUS: &'static str
The prime order of the field.
Must be consistent with the Field::MAX constant.
Sourceconst S: usize
const S: usize
The 2-adicity of the field, which is the exponent of 2 in the factorization of p-1.
Sourceconst MULTIPLICATIVE_GENERATOR: Self
const MULTIPLICATIVE_GENERATOR: Self
A fixed multiplicative generator of modulus - 1 order. This element must also be a
quadratic nonresidue.
Implementations of this trait MUST ensure that this is the generator used to derive
Self::ROOT_OF_UNITY.
Sourceconst MINUS_TWO: Self
const MINUS_TWO: Self
p-2, which is the exponent used for modular inversion on prime fields as per Fermat’s
Little Theorem.
Sourceconst ROOT_OF_UNITY: Self
const ROOT_OF_UNITY: Self
A primitive root of unity.
Sourceconst ROOT_OF_UNITY_INV: Self
const ROOT_OF_UNITY_INV: Self
The modular inverse of Self::ROOT_OF_UNITY.
Sourceconst DELTA: Self
const DELTA: Self
Generator of the t-order multiplicative subgroup.
It can be calculated by exponentiating Self::MULTIPLICATIVE_GENERATOR by 2^s, where
s is Self::S.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".