pub enum FieldOperation {
BasicArithmetic,
Inversion,
SquareRoot,
BatchOperations,
MultiExponentiation,
LegendreSymbol,
}Expand description
Operations that may or may not be supported by different field implementations.
This enum defines the various mathematical operations that field implementations can support. Some operations may not be available for certain moduli (e.g., square root may not exist for all elements in some fields), while others may be computationally expensive or have specialized implementations.
Variants§
BasicArithmetic
Basic arithmetic operations: addition, subtraction, and multiplication.
These are the fundamental operations that all field implementations should support. They include modular addition, subtraction, and multiplication with proper reduction modulo the field prime.
Inversion
Modular inversion: finding x such that (a * x) ≡ 1 mod p.
Not all elements have multiplicative inverses (specifically, zero does not). This operation typically uses the extended Euclidean algorithm.
SquareRoot
Square root computation in the field.
Computes x such that x² ≡ a mod p. This may not exist for all elements depending on the field properties (Tonelli-Shanks algorithm is commonly used).
BatchOperations
Batch operations: performing the same operation on multiple field elements.
This enables optimizations like Montgomery batch processing or SIMD operations when multiple field elements need the same operation applied.
MultiExponentiation
Multi-exponentiation: computing ∑ bᵢ * xᵢ^yᵢ for multiple bases and exponents.
This is a fundamental operation in cryptographic protocols and pairing-based cryptography. Efficient implementations use techniques like the Pippenger algorithm.
LegendreSymbol
Legendre symbol computation: determining if an element is a quadratic residue.
Computes the Legendre symbol (a/p) which indicates whether a has a square root modulo p. Returns 1 (quadratic residue), -1 (non-residue), or 0 (zero).
Trait Implementations§
Source§impl Clone for FieldOperation
impl Clone for FieldOperation
Source§fn clone(&self) -> FieldOperation
fn clone(&self) -> FieldOperation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more