crylib/finite_field.rs
1//! Finite field arithmetic.
2mod field_element;
3
4pub use field_element::FieldElement;
5
6use crate::big_int::UBigInt;
7
8/// A trait for describing a finite field.
9///
10/// # Safety
11/// `MODULUS` *MUST* be prime.
12pub unsafe trait FiniteField<const N: usize>
13where
14 Self: Sized + PartialEq + Copy + Clone + core::fmt::Debug,
15{
16 /// The modulus used to define the finite field.
17 ///
18 /// This value *MUST* be prime.
19 /// Using a non-prime number will result in undefined behavior.
20 const MODULUS: UBigInt<N>;
21
22 /// The smallest value in the finite field.
23 const MIN: FieldElement<N, Self> = FieldElement::ZERO;
24}