HomeCryptographyNTT: Fast Polynomial Multiplication for Lattice Crypto

NTT: Fast Polynomial Multiplication for Lattice Cryptography (2D Butterfly View)

Interactive 2D Number Theoretic Transform simulator: a real from-scratch Cooley-Tukey NTT (bit-reversal, butterfly network, modular arithmetic) multiplies two polynomials in the ring Kyber and Dilithium use, verified live against direct O(n²) convolution, plus a real timing benchmark of NTT vs. schoolbook as degree grows.

Cryptography2DAdvanced60 FPS📱 Mobile-adapted⇄ 3D version
2d-qe-topic-90 ↗ Open standalone

Every encryption and signature operation in post-quantum standards like CRYSTALS-Kyber and CRYSTALS-Dilithium boils down to multiplying polynomials inside a negacyclic ring ℤq[x]/(xⁿ+1). Done the naive way that costs O(n²) modular multiplications; done via the Number Theoretic Transform — the modular-arithmetic cousin of the FFT — it costs O(n log n). This 2D companion draws the real Cooley-Tukey butterfly network stage by stage on canvas (bit-reversal, twiddle-factor butterflies, pointwise multiply, inverse transform), cross-checks every result against a direct O(n²) convolution, and benchmarks real wall-clock timing of both methods as the polynomial degree grows.

⚙ Under the hood

Watch the real Number Theoretic Transform multiply two polynomials in the ring used by CRYSTALS-Kyber and Dilithium, stage by stage in 3D, and see it verified live against a slow O(n²) schoolbook convolution of the same two polynomials.

post-quantumNTTlattice cryptographyKyberDilithiumpolynomial multiplication

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)