primitives.goldilocks_jit#
Fast Goldilocks field arithmetic via Numba JIT.
Provides scalar and vectorized operations for GF(p) and GF(p³) that bypass galois library’s python-calculate mode for significant performance gains.
GF(p): Goldilocks prime p = 2^64 - 2^32 + 1 = 0xFFFFFFFF00000001 GF(p³): cubic extension with irreducible polynomial x³ - x - 1 (so x³ = x + 1)
- FF3 multiplication formula (derived from x³ = x + 1):
Let t = a1*b2 + a2*b1 c0 = a0*b0 + t c1 = a0*b1 + a1*b0 + t + a2*b2 c2 = a0*b2 + a1*b1 + a2*b0 + a2*b2
Functions#
|
Element-wise (a + b) mod p over uint64 arrays. |
|
Element-wise (a - b) mod p over uint64 arrays. |
|
Element-wise (a * b) mod p over uint64 arrays. |
|
Element-wise a^(p-2) mod p over uint64 arrays. |
|
Batch-invert N FF3 elements using Montgomery's trick. |