params

package
v1.4.0 Latest Latest
Warning

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

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

Documentation

Overview

Package params is the single Lux registry of cryptographic parameter identifiers. Every other package in luxfi/math (and downstream luxfi/lattice, luxfi/pulsar, luxfi/fhe, luxfi/lens) keys off these IDs; every cross-runtime KAT carries them; every backend dispatch uses them to route work.

LP-107 §"Parameter registry" — the canonical motivation. There must be exactly one place that names "Pulsar's modulus" or "FHE PN10QP27 ring dimension"; this package is that place.

IDs are stable strings — wire-formatted, log-printable, KAT-keyed. Renaming an ID is a breaking change. New IDs append; existing IDs never change semantics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendID

type BackendID string

BackendID names a math-substrate backend (CPU pure-Go, native CPU, CUDA, Metal, WGSL). The same NTT/Modarith/Poly contract may be realized by multiple backends; KATs prove they produce byte-equal output.

const (
	BackendPureGo BackendID = "pure-go"
	BackendNative BackendID = "native-cpu"
	BackendAVX2   BackendID = "avx2"
	BackendNEON   BackendID = "neon"
	BackendCUDA   BackendID = "cuda"
	BackendMetal  BackendID = "metal"
	BackendWGSL   BackendID = "wgsl"
)

func (BackendID) String

func (b BackendID) String() string

String makes BackendID printable.

func (BackendID) Validate

func (b BackendID) Validate() error

Validate reports whether b is a known backend.

type FHEParamID

type FHEParamID string

FHEParamID names a complete FHE scheme parameter set (ring + RNS chain + key-switching topology + bootstrap structure). Distinct from NTTParamID: one FHEParamID owns one or more NTTParamIDs.

const (
	FHE_PN10QP27       FHEParamID = "fhe-pn10qp27"
	FHE_PN11QP54       FHEParamID = "fhe-pn11qp54"
	FHE_PN9QP28_STD128 FHEParamID = "fhe-pn9qp28-std128"
)

func (FHEParamID) String

func (f FHEParamID) String() string

String makes FHEParamID printable.

func (FHEParamID) Validate

func (f FHEParamID) Validate() error

Validate reports whether f is a known FHE parameter set.

type HashSuiteID

type HashSuiteID string

HashSuiteID names a hash construction profile.

const (
	HashPulsarSHA3 HashSuiteID = "pulsar-sha3-v1"
	HashBLAKE3     HashSuiteID = "blake3-v1"
)

func (HashSuiteID) String

func (h HashSuiteID) String() string

String makes HashSuiteID printable.

func (HashSuiteID) Validate

func (h HashSuiteID) Validate() error

Validate reports whether h is a known hash suite.

type KATHeader

type KATHeader struct {
	ParameterSet          string      `json:"parameter_set"`
	ModulusID             ModulusID   `json:"modulus_id"`
	BackendID             BackendID   `json:"backend_id"`
	HashSuiteID           HashSuiteID `json:"hash_suite_id"`
	ImplementationName    string      `json:"implementation_name"`
	ImplementationVersion string      `json:"implementation_version"`
}

KATHeader is the canonical key-set every KAT vector MUST carry. LP-107 §"Parameter registry" requirement: every KAT entry binds itself to a specific (parameter_set, modulus, backend, hash_suite, implementation_version) tuple so cross-runtime replay can match like-for-like.

func (*KATHeader) Validate

func (h *KATHeader) Validate() error

Validate ensures every required field is set and known.

type ModulusID

type ModulusID string

ModulusID names a single prime modulus.

Production identifiers MUST satisfy: stable string, lowercase, hex representation of the modulus where applicable, prefixed by the owning protocol/scheme name. Validation: see Modulus.Validate.

const (
	// ModPulsarQ — Pulsar/LP-073 canonical NTT-friendly prime.
	// Q = 0x1000000004A01 ≈ 2^48; satisfies (Q - 1) | 2N for N = 256.
	ModPulsarQ ModulusID = "pulsar-q-0x1000000004a01"

	// ModNTT998 — classical NTT-friendly prime 998244353
	// (used by general vector kernels and tests; not production crypto).
	ModNTT998 ModulusID = "ntt-998244353"

	// ModFHE_PN10QP27 — first FHE production parameter set; 27-bit Q,
	// ring dimension N = 1024.
	ModFHE_PN10QP27 ModulusID = "fhe-pn10qp27"

	// ModFHE_PN11QP54 — second FHE production parameter set; 54-bit Q,
	// ring dimension N = 2048.
	ModFHE_PN11QP54 ModulusID = "fhe-pn11qp54"

	// ModFHE_PN9QP28_STD128 — STD128-tagged FHE parameter set;
	// ring dimension N = 512.
	ModFHE_PN9QP28_STD128 ModulusID = "fhe-pn9qp28-std128"
)

func (ModulusID) String

func (m ModulusID) String() string

String makes ModulusID printable.

func (ModulusID) Validate

func (m ModulusID) Validate() error

Validate reports whether m is a known modulus identifier in this process. Unknown IDs are rejected — there is no implicit registration.

type NTTParamID

type NTTParamID string

NTTParamID names an (N, Q, root) triple for an NTT instance. One ModulusID may have multiple NTTParamID values (different N).

const (
	// NTTPulsarN256 — Pulsar's R_q = Z_q[X]/(X^256 + 1) at Q = ModPulsarQ.
	NTTPulsarN256 NTTParamID = "pulsar-n256-q0x1000000004a01"

	// NTTFHE_PN10QP27_N1024 — FHE PN10QP27 ring at N = 1024.
	NTTFHE_PN10QP27_N1024 NTTParamID = "fhe-pn10qp27-n1024"

	// NTTFHE_PN11QP54_N2048 — FHE PN11QP54 ring at N = 2048.
	NTTFHE_PN11QP54_N2048 NTTParamID = "fhe-pn11qp54-n2048"

	// NTTFHE_PN9QP28_N512 — FHE PN9QP28 ring at N = 512.
	NTTFHE_PN9QP28_N512 NTTParamID = "fhe-pn9qp28-n512"
)

func (NTTParamID) String

func (p NTTParamID) String() string

String makes NTTParamID printable.

func (NTTParamID) Validate

func (p NTTParamID) Validate() error

Validate reports whether p is a known NTT parameter identifier.

type PulsarParamID

type PulsarParamID string

PulsarParamID names a Pulsar threshold-signature parameter set.

const (
	// PulsarLP073 — canonical LP-073 Pulsar parameter set.
	PulsarLP073 PulsarParamID = "pulsar-lp073"
)

func (PulsarParamID) String

func (p PulsarParamID) String() string

String makes PulsarParamID printable.

func (PulsarParamID) Validate

func (p PulsarParamID) Validate() error

Validate reports whether p is a known Pulsar parameter set.

Jump to

Keyboard shortcuts

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