Number Theory: Cryptographic Foundations and Lattices
Number theory, once considered the purest of mathematics without real-world utility, is now the load-bearing infrastructure of global communication security. This article focuses on the integer properties, modular arithmetic, and polynomial geometries required to implement modern asymmetric and post-quantum cryptography.
1. Modular Arithmetic: The Geometric Intuition
The core of modern cryptography is arithmetic modulo n, the Ring \mathbb{Z}/n\mathbb{Z}.
1.1 "Clock" and "Chord" Visualizations
Modular arithmetic is geometrically understood as "Circle Math".
- Addition (Rotation): Adding a value is a rotation around the perimeter of a circle with n points.
- Multiplication (Cardioids): If you map every point x to x \cdot 2 \pmod n and draw a chord between them, you generate a Cardioid (heart shape). Mapping x \to x \cdot 3 \pmod n generates a Nephroid. This dense geometric folding is what creates the "chaotic mixing" necessary for cryptographic hashes.
1.2 Core Operational Theorems
- Bézout's Identity: For any a, b, there exist integers x, y such that ax + by = \gcd(a, b).
- Modular Inverse: If \gcd(a, n) = 1, then a has a multiplicative inverse a^{-1} \pmod n, found rapidly via the Extended Euclidean Algorithm.
2. Classical Asymmetric Cryptography
2.1 Prime Distribution and RSA
The Prime Number Theorem dictates the density of primes near x is $1/\ln x$. This guarantees that randomly searching for massive primes (via the probabilistic Miller-Rabin test) is computationally trivial.
RSA Key Generation Example:
- Primes p=61, q=53 \implies n = p \times q = 3233.
- Totient \phi(n) = (p-1)(q-1) = 3120.
- Public exponent e = 17.
- Private exponent d = e^{-1} \pmod{3120} = 2753.
- Encryption/Decryption: c = m^{17} \pmod{3233}, m = c^{2753} \pmod{3233}.
2.2 The Discrete Logarithm Problem (DLP)
Diffie-Hellman and Elliptic Curve Cryptography (ECC) rely on the difficulty of finding x in g^x \equiv y \pmod p.
- Elliptic Curve DLP (ECDLP): Unlike standard modular exponentiation (which is vulnerable to sub-exponential Index Calculus attacks), ECDLP has no known sub-exponential attacks. This geometric algebraic structure allows 256-bit ECC keys to match the security of 3072-bit RSA.
3. Post-Quantum Cryptography: Lattice Theory
Shor's Algorithm on a sufficiently large quantum computer will break RSA and ECC by solving integer factorization and DLP in polynomial time. The future of cryptography relies on high-dimensional Number Theory: Lattice-Based Cryptography.
3.1 Hard Lattice Problems
Lattice security relies on geometric grids in hundreds of dimensions (n > 256).
- Shortest Vector Problem (SVP): Given an arbitrary basis for a lattice, find the shortest non-zero vector.
- Learning With Errors (LWE): Finding a secret vector given a set of linear equations perturbed by small, random errors. Without the private key (a "good" basis), the noise cannot be filtered.
3.2 Kyber (ML-KEM) vs. NTRU
The NIST FIPS 203 standard for key exchange is Kyber (ML-KEM).
- Module-LWE: Kyber operates over polynomial rings, specifically R_q = \mathbb{Z}_q[X] / (X^n + 1) where n=256 and q=3329.
- Number Theoretic Transform (NTT): A generalization of the Fast Fourier Transform applied to finite fields. Kyber relies heavily on NTT to perform lightning-fast polynomial multiplications, making it dramatically faster than RSA.
- NTRU Comparison: NTRU is an older standard based on finding short vectors in specifically constructed NTRU lattices. While highly secure, Kyber's reduction to worst-case LWE proofs made it the industry standard.
4. Number Theory in Zero-Knowledge Proofs (ZKP)
Modern ZKPs (like zk-SNARKs) rely on complex finite field operations to allow a prover to verify knowledge without revealing it.
- Legendre Symbol (\frac{a}{p}): Computes whether a is a quadratic residue (a perfect square) \pmod p.
- Roots of Unity: Deeply integrated into polynomial commitment schemes, allowing rapid verification of computational traces across untrusted networks.