Documentation
¶
Overview ¶
Package hqc is the public accel surface for HQC (Hamming Quasi-Cyclic) post-quantum KEM operations.
HQC is the NIST PQC Round-4 selected code-based KEM (NIST IR 8528, March 2025). Family-disjoint from ML-KEM: a structural break against MLWE does NOT compromise HQC, and vice-versa.
This package is a thin re-export of accel/ops/code, named for the HQC primitive rather than the cryptographic family. The split exists so callers can write
import "github.com/luxfi/accel/hqc"
and have hqc.Mode / hqc.KeypairBatch / hqc.EncapsBatch / etc. line up with crypto/hqc.Mode and crypto/hqc.* without a "code" layer of indirection in import paths.
There is exactly one canonical home for each concern:
luxcpp/gpu/src/hqc_*.cpp <-- C++ canonical kernels (Metal/CUDA/CPU) luxcpp/gpu/include/lux/gpu/hqc.h <-- C ABI luxfi/accel/ops/code/ <-- Go binding to the C ABI luxfi/accel/hqc/ (this pkg) <-- HQC-named re-export luxfi/gpu/hqc_*.go <-- direct binding for low-level ops luxfi/crypto/hqc/ <-- consumer Go package
No primitive lives in more than one place. Re-exports are aliases, not new implementations.
Index ¶
- Constants
- Variables
- func DecapsBatch(mode Mode, sss, cts, sks []byte, count int) error
- func EncapsBatch(mode Mode, cts, sss, pks, seeds []byte, count int) error
- func GF2PolymulBatch(mode Mode, c, a, b []uint64, count int) error
- func KeypairBatch(mode Mode, pks, sks, seeds []byte, count int) error
- func ReedSolomonDecodeBatch(mode Mode, msgs, cdws []byte, count int) error
- type Mode
- type Params
Constants ¶
Variables ¶
var ( ErrInvalidMode = code.ErrInvalidMode ErrInvalidInput = code.ErrInvalidInput ErrSeedExhausted = code.ErrSeedExhausted ErrCountZero = code.ErrCountZero ErrBufferSizeInvalid = code.ErrBufferSizeInvalid )
Error sentinels re-exported.
Functions ¶
func DecapsBatch ¶
DecapsBatch performs count independent decapsulations. HQC uses Hofheinz-Hövelmanns-Kiltz implicit rejection: a tampered ciphertext yields a pseudorandom shared secret rather than an error.
func EncapsBatch ¶
EncapsBatch performs count independent encapsulations.
func GF2PolymulBatch ¶
GF2PolymulBatch multiplies pairs of GF(2)^N polynomials mod (X^n - 1). Used inside HQC encapsulation (PKE) and decapsulation (FO-transform re-encryption). The lib is bit-sliced Karatsuba, identical to PQClean.
func KeypairBatch ¶
KeypairBatch generates count independent HQC keypairs. See code.HQCKeypairBatch for layout requirements.