Author: Elson Liu
Quantum computing continues to develop at a staggering pace. With traditional cryptographic schemes—like RSA and Elliptic Curve Cryptography (ECC)—going bust in the dooming presence of advanced quantum algorithms (i.e. Shor’s algorithm), cryptographers are in urgent need of a quantum resistant solution. One of the most promising candidates is lattice-based cryptography.
In this article, we’ll introduce the fundamental concepts of lattice-based cryptography and discuss why it’s such a critical technology for “future-proofing” digital security.
Quantum computing has the potential to revolutionize computation by solving certain hard mathematical problems at unprecedented speeds. As of July 2024, superconducting qubits are expected to reduce the time required for the factorization of a 576-bit number from months down to 3 hours. For traditional cryptography, this is a looming nightmare; Shor’s algorithm can efficiently factor large numbers, which underpins the security of RSA, and can tackle discrete logarithms used in ECC. As quantum machines mature, these once-unfeasible attacks could become trivial, threatening to unravel the security that underlies the internet, financial transactions, and secure communications.
A lattice, in mathematical terms, can be visualized as a grid of points extending infinitely in multiple dimensions. Each point in this grid is formed by taking integer combinations of a set of basis vectors. Concretely, if you have basis vectors the lattice is the set of all points you can form by summing integer multiples of these vectors. As a quick example, let’s select two linearly independent base vectors in R2 to construct a 2-dimensional lattice: and .
With these two base vectors as a foundation, we can construct the full lattice by trying all the linear combinations of the base vectors with integer coefficients, also expressed as:
, where and are integers, which satisfies and takes on all integer values. This construction creates a discrete set of points in , forming a regular pattern that repeats periodically and infinitely in all directions. Each point in this lattice can be reached by integer combinations of the base vectors and .
This geometric structure provides a rich source of hard mathematical problems even for quantum computers. Two of the most celebrated hard problems used in lattice- based cryptography are:
Shortest Vector Problem (SVP): Given a lattice, the SVP asks you to find the shortest nonzero vector in that lattice. For example, in the 2D lattice we just defined, we need to consider various combinations:
• , length = 2
• , length =
• , length =
• $2b_1 − b_2 $ , length =
In this case, the shortest non-zero vector is with length 2.
Although this process seems intuitive, keep in mind that this is a straightforward 2D lattice with “nice” base vectors. If the base vectors are highly skewed—almost parallel—finding the shortest vector becomes excruciatingly difficult. This is because finding the shortest vector would require a lot more than four checks, increasing the computational effort required. Furthermore, we can make this even harder on top of using nearly parallel vectors by using a higher dimensional lattice. The number of potentially shortest vectors grows exponentially with the dimension, which makes an exhaustive search for high dimensional lattices impractical.
Learning with Errors (LWE): The LWE problem revolves around the difficulty of solving systems of linear equations slightly “noised” by small errors, which disables simple algebraic techniques. Specifically, in a finite field defined by the modulus of a random integer, we pick a random vector . We then decide on a secret vector, in the same finite field and use and $a_i $to generate a vector with a small error, added. The goal is to recover the secret vector . For example, let’s consider the following:
Given:
Modulus
Dimension
Secret vector mod
Error distribution χ: uniform from the set {-1, 0, 1}
LWE samples , where is random in mod 17 and mod : ),
mod mod mod
,
mod mod mod
,
mod mod mod
The LWE problem is to recover the secret vector given only the samples . This is extremely challenging; as the modulus number and the dimensions of the lattice increases, the difficulty of the problem increases exponentially. Furthermore, even the fastest known quantum algorithm solves LWE in exponential time. While there are examples like AlphaQubit, a quantum error correction system developed by Google, that has shown success in decoding the surface code, which is related to error correction in quantum computing, the large-scale decryption remains infeasible. LWE underpins many lattice-based schemes, and its versatility has made it one of the cornerstones of post-quantum cryptography.
These two problems are applied to the famous Goldreich-Goldwasser-Halevi (GGH) encryption. Alice, the receiving party, first picks a “good” pair of base vectors to generate a high dimensional lattice. In this same lattice, structure, a “bad” pair of nearly parallel vectors are used as the public key to generate the cipher text, turning the process of deciphering into a version of solving the SVP. In the process of encryption, a random error is also chosen and incorporated into the cipher text by Bob, the encrypting party, which adds the difficulty of the LWE problem. Since Alice has access to the “good” pair of base vectors, she is able to recover the original message.
Here’s a run through:
Key Generation: Alice chooses a private "good" basis :
She then selects a unimodular matrix (its inverse also has all integer entries):
The public "bad" basis is computed as . First, compute :
Calculate the entries:
So,
Encryption
Bob wants to encrypt the message . He chooses a random error vector . Compute . First, calculate
This is a 1 x 2 vector times a 2 x 2 matrix:
= . Now add the error vector .
So, the cipher text is .
Decryption
Alice receives . To recover m, Alice uses . Since , its inverse is: . Compute : = = = ≈ .
Round each component to the nearest integer: → .
Now, multiply by . Since , you can find (the inverse of U). The inverse of U is (divided by the determinant 1, since U is unimodular: . Compute
= = [2, -5].
This returns the original message .
Oasis Labs: Oasis Labs is a pioneer in blockchain privacy technology founded Berkeley professor, Dr. Dawn Song. By leveraging Secure Multi-Party Computation (SMPC) techniques (which can be built on lattice-based foundations), Oasis Labs protects users’ sensitive data— such as ethnicity information on Instagram—without revealing it to third parties. Crucially, they created the idea of “smart privacy”, which allowed privacy features to be implemented on existing smart contracts through Sapphire, a confidential EVM (Ethereum Virtual Machine) that enables granular privacy control.
CRYSTALS-Dilithium: This post-quantum digital signature scheme is built on lattice problems and offers smaller private keys and faster signatures than many traditional alternatives. It’s already gaining traction as one of the leading candidates for future authentication standards after submitting to NIST's post-quantum cryptography standardization process and becoming a finalist.
QAN Platform: QAN is a quantum-resistant blockchain platform that incorporates lattice-based cryptography to secure decentralized applications and financial transactions against future quantum threats. This ensures that the integrity of blockchain systems remains robust, even as quantum machines scale up. They developed the QAN virtual machine (QAN) that enables the execution of contracts in multiple different languages while ensuring compatibility with EVM.
As the world braces for the quantum computing revolution, it’s becoming increasingly clear that lattice-based cryptography shines as a beacon of hope. Whether it’s through the GGH scheme or other integrations, the mathematical complexity of lattices allows for a range of challenging problems even for the future. As we advance our understanding on both the quantum and the lattice frontier, I remain hopeful that more efficient and secure scheme will emerge to create a privacy preserving future.
Thanks for reading!