Documentation
¶
Overview ¶
Package lattice provides GPU-accelerated lattice cryptography operations.
Used for FHE (Fully Homomorphic Encryption), post-quantum signatures, and other lattice-based cryptographic schemes.
Index ¶
- Variables
- func BatchNTTForward(params NTTParams, polys [][]uint64) ([][]uint64, error)
- func BatchNTTInverse(params NTTParams, polys [][]uint64) ([][]uint64, error)
- func MLDSANTTBatch(polys [][]int32, inverse bool) error
- func MLDSANTTForward(coeffs []int32) error
- func MLDSANTTInverse(coeffs []int32) error
- func NTTForward(params NTTParams, coeffs []uint64) ([]uint64, error)
- func NTTInverse(params NTTParams, evals []uint64) ([]uint64, error)
- func PolyAdd(modulus uint64, a, b []uint64) ([]uint64, error)
- func PolyMul(params NTTParams, a, b []uint64) ([]uint64, error)
- func PolySub(modulus uint64, a, b []uint64) ([]uint64, error)
- func SampleNTT(params NTTParams, seed []byte) ([]uint64, error)
- type NTTParams
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func BatchNTTForward ¶
BatchNTTForward performs forward NTT on multiple polynomials in parallel.
func BatchNTTInverse ¶
BatchNTTInverse performs inverse NTT on multiple polynomials in parallel.
func MLDSANTTBatch ¶ added in v1.2.0
MLDSANTTBatch performs the in-place forward (inverse=false) or inverse (inverse=true) Number-Theoretic Transform over Z_q[X]/(X^256 + 1) with q = 8380417 (the FIPS 204 ML-DSA prime) on every polynomial in polys.
Each polys[i] MUST have length 256. The transform writes back into the input slice in-place.
Byte-equal to PQCLEAN_MLDSA65_CLEAN_ntt (forward) and PQCLEAN_MLDSA65_CLEAN_invntt_tomont (inverse). The dispatcher engages the GPU substrate when len(polys) >= accel.MLDSABatchThreshold AND the substrate ships an implementation; otherwise this falls through to the per-poly Go oracle below, which is the canonical CPU reference for Pulsar's byte-equality regression test.
func MLDSANTTForward ¶ added in v1.2.0
MLDSANTTForward is the single-poly convenience wrapper around MLDSANTTBatch. Returns ErrInvalidDegree if len(coeffs) != 256.
func MLDSANTTInverse ¶ added in v1.2.0
MLDSANTTInverse is the single-poly convenience wrapper around MLDSANTTBatch (inverse direction).
func NTTForward ¶
NTTForward performs forward Number Theoretic Transform. Transforms polynomial from coefficient to evaluation form.
func NTTInverse ¶
NTTInverse performs inverse Number Theoretic Transform. Transforms polynomial from evaluation to coefficient form.
func PolyMul ¶
PolyMul multiplies two polynomials using NTT. Result is (a * b) mod (X^N + 1) mod modulus.