hqc

package
v1.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0

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

View Source
const (
	// HQC128 — NIST PQ Category 1 (~AES-128).
	HQC128 = code.HQC128
	// HQC192 — NIST PQ Category 3 (~AES-192).
	HQC192 = code.HQC192
	// HQC256 — NIST PQ Category 5 (~AES-256).
	HQC256 = code.HQC256
)

Variables

View Source
var (
	ErrInvalidMode       = code.ErrInvalidMode
	ErrInvalidInput      = code.ErrInvalidInput
	ErrSeedExhausted     = code.ErrSeedExhausted
	ErrCountZero         = code.ErrCountZero
	ErrBufferSizeInvalid = code.ErrBufferSizeInvalid
)

Error sentinels re-exported.

Functions

func DecapsBatch

func DecapsBatch(mode Mode, sss, cts, sks []byte, count int) error

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

func EncapsBatch(mode Mode, cts, sss, pks, seeds []byte, count int) error

EncapsBatch performs count independent encapsulations.

func GF2PolymulBatch

func GF2PolymulBatch(mode Mode, c, a, b []uint64, count int) error

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

func KeypairBatch(mode Mode, pks, sks, seeds []byte, count int) error

KeypairBatch generates count independent HQC keypairs. See code.HQCKeypairBatch for layout requirements.

func ReedSolomonDecodeBatch

func ReedSolomonDecodeBatch(mode Mode, msgs, cdws []byte, count int) error

ReedSolomonDecodeBatch decodes count RS codewords (constant-time Berlekamp).

Types

type Mode

type Mode = code.Mode

Mode aliases the underlying parameter-set enum.

type Params

type Params = code.Params

Params aliases the byte-size descriptor.

func ParamsFor

func ParamsFor(mode Mode) Params

ParamsFor returns the canonical sizes for mode.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL