Documentation
¶
Overview ¶
Copyright (c) 2026 Lux Industries Inc. SPDX-License-Identifier: BSD-3-Clause
emit_modarith_kat — produces the canonical cross-runtime KAT bundle for luxfi/math/modarith. The C++ side at luxcpp/crypto/math/test/ modarith_cross_runtime_test.cpp reads the same JSON and asserts byte-equal Montgomery / Add / round-trip behavior on every entry.
LP-107 Phase 6.3: Go emits → C++ verifies. Cross-runtime release gate for modular arithmetic.
Usage:
go run ./cmd/emit_modarith_kat --out testdata/modarith_kat.json
Each entry's input is a packed little-endian byte stream:
"MontMulMod/...": q (8) || a (8) || b (8) -> output = MulMod(a,b,q) (8) "AddMod/...": q (8) || a (8) || b (8) -> output = (a+b) mod q (8) "MontgomeryRoundTrip/...": q (8) || x (8) -> output = x (8)
Determinism: operand stream is the SHA-256 hash chain of a fixed seed string. Same emit run → byte-equal JSON.
Click to show internal directories.
Click to hide internal directories.