$ show mthiim/dilithium-java
This repository implements the Dilithium post-quantum cryptographic signature algorithm as a Java Cryptography Extension (JCE) provider. It provides a complete implementation of the Dilithium algorithm (version 3.1) including key pair generation, signing, and signature verification. The architecture follows standard JCE provider patterns with clean separation between the core cryptographic implementation, provider interfaces, and algorithm-specific implementations. The library passes known-answer tests from the reference implementation and includes performance benchmarks.
The LLM identified 3 files worth highlighting for reuse:
Implements polynomial operations in the ring R_q = Z_q[X]/(X^n+1) required for Dilithium. Includes Number Theoretic Transform (NTT) implementation, polynomial arithmetic, reduction, and decomposition operations. Demonstrates non-obvious skill in implementing lattice-based cryptographic primitives correctly and could be extracted for use in other module-lattice based schemes with minimal modification.
Implements vector of polynomials operations building on the Poly class. Provides vector arithmetic, NTT transforms, and decomposition functions. Shows effective use of Java streams for clean, readable implementation of vector operations. Reusable for other module-lattice based cryptographic schemes.
Handles serialization and deserialization of Dilithium keys and signatures according to the specification. Implements precise bit-level packing/unpacking logic for various data types (eta-packed, t0-packed, t1-packed, etc.). Demonstrates careful attention to the Dilithium specification and could be reused in other Dilithium implementations.