Files
Hanzo AI 02fd28b349 fhe: KAT oracle + regen-kats.sh for cross-runtime byte-equality (LP-167)
Lands the Lux FHE-KAT corpus generators consumed by the C++ production
runtime at github.com/luxfi/luxcpp/crypto/fhe (LP-167). Mirrors the
pulsar/lens/warp regen script shape; emits a sha256 manifest and
supports --verify mode for determinism diffing.

Delivered:
  cmd/kat_oracle/main.go               KAT oracle. --emit --out <dir>
                                       writes one JSON entry per
                                       (param_set, seed) tuple. Each
                                       entry pins parameter-set ID,
                                       seed, operation tag, and a
                                       CRC32 fingerprint of the SHA-256
                                       digest of the canonical SecretKey
                                       MarshalBinary output.
  scripts/regen-kats.sh                Driver: runs kat_oracle, runs the
                                       in-tree determinism tests
                                       (TestNewKeyGeneratorFromSeed_Deterministic
                                       + TestNewKeyGeneratorFromSeed_DifferentSeeds),
                                       emits manifest. --verify mode
                                       diffs against existing manifest;
                                       fails on mismatch.
  scripts/regen-kats.manifest.sha256   Initial 4-entry manifest:
                                       PN10QP27 / PN11QP54 × seed-zero /
                                       seed-lp167-stable.

Verification:
  $ LUXCPP_DIR=$HOME/work/luxcpp scripts/regen-kats.sh --verify
  OK: Lux FHE KAT regeneration is byte-equal across runs (4 files)

  $ cd \$HOME/work/luxcpp/crypto/fhe
  $ ctest --test-dir build -R fhe_kat_replay
  OK lux-fhe-cpp KAT replay (4 entries)

LP-167 §"Cross-runtime KAT contract" requires both directions of
byte-equality. The Go→C++ direction is exercised by this commit and
the C++ replay test. The reverse direction (C++ generates, Go
verifies) is queued behind v0.1.0-rc2-fhe-gpu in lockstep with the
production CUDA NTT + key-switch + bootstrap kernels.

go test -count=1 -timeout=300s ./...  ->  3/3 ok
  ok  github.com/luxfi/fhe                 48.345s
  ok  github.com/luxfi/fhe/pkg/encrypted   98.833s
  ok  github.com/luxfi/fhe/pkg/threshold    0.778s
2026-03-03 12:00:00 -08:00
..