Skip to main content

PrimeField

Trait PrimeField 

Source
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§

Source

const MODULUS: &'static str

The prime order of the field.

Must be consistent with the Field::MAX constant.

Source

const S: usize

The 2-adicity of the field, which is the exponent of 2 in the factorization of p-1.

Source

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.

Source

const MINUS_TWO: Self

p-2, which is the exponent used for modular inversion on prime fields as per Fermat’s Little Theorem.

Source

const TWO_INV: Self

2^-1

Source

const ROOT_OF_UNITY: Self

A primitive root of unity.

Source

const ROOT_OF_UNITY_INV: Self

The modular inverse of Self::ROOT_OF_UNITY.

Source

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".

Implementors§

Source§

impl PrimeField for Scalar

Source§

const MODULUS: &'static str = "0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001"

Source§

const S: usize = 32

Source§

const MULTIPLICATIVE_GENERATOR: Self

Source§

const MINUS_TWO: Self

Source§

const TWO_INV: Self

Source§

const ROOT_OF_UNITY: Self

Source§

const ROOT_OF_UNITY_INV: Self

Source§

const DELTA: Self