Post-Quantum Cryptography Tooling

Optimizing the Leading Lattice Sieving Toolkit

Post-quantum cryptography standards like Kyber and Dilithium are built on the assumption that lattice problems are hard. Testing that assumption requires attacking those lattices with the best tools available — and the best tool is G6K. I optimize G6K's C++ sieving engine and its supporting infrastructure. The main performance work lives in the C++ core. Alongside that, I rewrote the spherical code generator — a Python hill-climber that produces SimHash probe banks — in Rust with an algorithmic fix that cut generation time by two orders of magnitude.

G6K is the toolkit the research community reaches for when stress-testing lattice-based cryptographic schemes — the systems that NIST is standardizing as post-quantum replacements for RSA and ECC. The sieving engine at G6K's core is C++, and that is where the primary optimization work happens: the inner loops that search for short lattice vectors across databases that grow exponentially with dimension. Performance gains in the C++ core translate directly into higher dimensions reached and tighter security estimates for production cryptographic standards.

One concrete example: G6K's SimHash filter depends on sparse spherical codes generated by a Python hill-climber that took minutes per dimension. I rewrote the generator in Rust around the observation that a coordinate swap only modifies one row of the Gram matrix — collapsing per-swap cost from O(N·n) to O(N). The tool now generates the full code bank for dimensions 6 through 1000 on a laptop, with strictly better output quality. But this is a supporting tool. The main work is in the C++ sieving engine itself.

  1. G6K C++ Sieving Engine Optimization

    G6K Lattice Sieving Toolkit

    Performance engineering on G6K’s C++ core — the sieving inner loop that maintains vector databases and searches for reduction pairs across exponentially growing dimensions. This is the primary optimization surface: gains in the C++ engine determine what dimensions are practically reachable and how tight the resulting security estimates are for NIST post-quantum standards.

  2. 100× Spherical Code Generator in Rust

    G6K Lattice Sieving Toolkit

    Rewrote the Python hill-climber that generates SimHash probe banks. Incremental Gram matrix updates collapse per-swap cost from O(N·n) to O(N). A single dimension (n=128, bitlen=512) dropped from 3–6 minutes to 2–5 seconds. The full sweep across n=6..1000 completes on a laptop instead of running for days. Output files are byte-identical — drop-in replacement, no downstream changes required.

  3. Property-Tested Numerical Correctness

    G6K Lattice Sieving Toolkit

    Built a property-test suite verifying that every incremental Gram matrix update and every cached row-sum-of-squares matches a from-scratch recompute on every entry. This test caught two off-by-one bugs during development that would have produced silently wrong spherical codes — codes that pass format checks but degrade SimHash filter quality in ways that only surface as unexplained sieving slowdowns.

C++RustrayonPost-Quantum CryptographyLattice SievingSimHashLinear AlgebraHill ClimbingProperty TestingLTO

Cryptographic research tooling demands the same correctness guarantees as financial infrastructure. See why Rust is the foundation for systems where silent bugs have outsized consequences.

Rust for Mission-Critical Systems Why Rust When Failure Is Not an Option

Rust compiled to WebAssembly brings systems-level performance to the browser. See how I built cryptographic pipelines for ZK proof generation in client-side wallet engines.

Rust and WebAssembly Native Performance in the Browser

ZK-SNARK systems share the same intersection of cryptography and performance engineering. See how I built production proving pipelines at Panther Protocol.

ZK-SNARK Development From Circuits to Production Wallets

Research code bottlenecking your experiments?

Cryptographic research tools are full of inner loops that silently recompute invariant work. I find the algorithmic fix first, then build the Rust implementation that makes parameter sweeps practical instead of prohibitive. If your sieving, proving, or numerical pipeline has a Python bottleneck that JIT alone cannot fix, let’s talk.

Discuss your cryptography tooling