(Draft) Lattice-based crypto - introduction
During the Corona situation, I decided to learn something new, and it was lattice-based cryptography.
Intro to LWE from knapsack problem
From this slide
1D (modular) knapsack problem
Given and , , where all variables are integers. Find s.t. ,
Vector modular knapsack problem
Given and , , where and . Find s.t. ,
We can extend the value of from to where . This extension is kanpsack problem -> BKP (Bounded Knapsack Problem) -> UKP (Unbounded Knapsack Problem)
Vector modular knapsack problem in Matrix format
The equation can be expressed in Matrix form. Let be “-th element of the vector $\pmb{a}jt_j = \displaystyle\sum{i=1}^{n} a_{ji}x_i\bmod q\pmb{A} = (\pmb{a}_1, \pmb{a}_2,\cdots,\pmb{a}_n)$, the vector knapsack problem can be expressed as follows:
Given , , and . Find , s.t.,
How hard to solve the vector knapsack problem
- If , the problems can be solved easily by Gaussian elimination ().
- If , the unbounded knapsack problem (integer knapsack problem) is NP-complete.
- Some are solavble in polynomial times. There is an algorithm (LLL lattice basis reduction) to get an approximate answer (or an exact answer sometimes) of this problem in polinomial time ( where is the longest length of under the Euclidean norm), under som conditions (refer to Wikipedia).
- So, in case of , the time complecitiy is NP.
Example of LLL:
- https://math.mit.edu/~apost/courses/18.204-2016/18.204_Xinyue_Deng_final_paper.pdf
- https://zhenfeizhang.github.io/talks/improve_LLL.pdf
- Real value example 1: https://www.youtube.com/watch?v=XEMEiBcwSKc
- Real value example 2: https://www.youtube.com/watch?v=n5MfVR77BTw
From knapsack to LWE
We can lead LWE from vector knapsack problem.Here is the step by step instructions. (I omitted all .)
This is a visualized vector knapsack problem:

Split the Matrix as follows:

It can be written .
Multiply from left:

Redefine as , and as :

Split the vector into :

Split the multiplication:

And finally, redfine as :

This is the LWE (Learning With Errors).
Notes
The complexity of finding the inverse is (Gaussian elimination), but the complexity of “finding and ” is , because the complexity of a vector knapsack problem is .
LWE problem
The first definition of LWE appears in the famous paper from Regev.
You can find a free version from https://cims.nyu.edu/~regev/papers/qcrypto.pdf.
First, Regev introduced “learning from parity with error problem” as follows:
Let , , and .
Find from given pairs , s.t.,
This problem is one of the simplest 0-1 modular knapsack problem, if there is no error ().
From this problem we can extend:
- to , where is a prime integer, and .
- to an error distribution function .
This extended problem is called problem.
Application to public key encryption
At the end of the paper from Regev, they propose how to apply this LWE problem into public key encryption.
Examples
https://www.esat.kuleuven.be/cosic/blog/introduction-to-lattice-based-cryptography-part-2-lwe-encryption/ <- contains some errors.
entities
- Plain text:
- Prime number
- Dimention
The is a secret key.
How to create public key:
How to encrypt :
How to decrypt :
real value example
- Prime number: 17
- Dimention: 3
https://www.slideserve.com/felcia/lattice-based-cryptography <- actual values.
LWE definition (Wiki) -> decisional LWE -> RLWE (polynomial) -> NTRU