AES and NP-Hardness in Cryptography
AES and NP-Hardness in Cryptography
PROBLEMS
February 4, 2024
1/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Introduction
Chapter Objectives
Introduction
3/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory
Moving Forward
4/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
5/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
6/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
7/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
8/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
When provided with a set of n items each with distinct weights wi , the
objective is to determine if it’s feasible to select items for a knapsack to
reach a precise weight S. If such a selection is possible, the question
further asks whether it’s plausible to find binary values bi in {0, 1} such
that S = b1 · w1 + b2 · w2 + . . . + bn · wn . It’s important to note that we
assume there exists only one feasible combination of weights.
In summary, the Knapsack (Search) Problem delves into the feasibility of
assembling items into a knapsack to achieve a target weight S, along with
the potential to discover the binary values bi corresponding to this
configuration.
9/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
10/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Complexity Class P
A decision problem DP, defined by a set S, falls into the complexity class
P if there exists an algorithm capable of taking any instance ι and
determining whether ι ∈ S or not in polynomial time. Time complexity
here is measured in terms of bit operations, and polynomial time implies
that the number of bit operations is limited by some polynomial function
of the input size of ι.
Problems within complexity class P are those for which we possess an
”efficient” solution algorithm. Essentially, elements in complexity class P
are considered to be easily computable. For instance:
▶ Given integers x, y , and z, can we determine if z = x · y ? In other
words, is multiplication an easy operation?
▶ Given a ciphertext c, a key k, and a plaintext m, can we ascertain if c
represents the encryption of m under your preferred encryption
algorithm?
11/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Complexity Class PP
A decision problem DP, defined by a set S, falls into the complexity class
PP if there exists an algorithm capable of taking any instance ι and
determining whether ι ∈ S or not in polynomial time. Time complexity
here is measured in terms of bit operations, and polynomial time implies
that the number of bit operations is limited by some polynomial function
of the input size of ι.
12/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Complexity Class PP
13/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Complexity Class PP
14/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Complexity Class NP
15/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Complexity Class NP
The class NP, known as non-deterministic polynomial time, encompasses
decision problems for which, if the answer is affirmative (yes), there exists
a witness that can validate this assertion within polynomial time.
However, in cases where the answer is negative (no), we don’t assume the
algorithm necessarily concludes. Nevertheless, if it does, it must answer
no. The notion of a witness can be likened to a proof demonstrating that
the instance ι indeed belongs to the subset S.
Examples of such problems include:
▶ The problem ”Is N composite?” belongs to NP because a non-trivial
prime factor can serve as a witness, and this witness can be verified in
polynomial time through division.
▶ The problem ”Is G k-colourable?” is in NP since a witness can be
provided in the form of a valid coloring.
▶ The problem ”Does this knapsack problem have a solution?” is in NP
because the values bi can serve as a witness for the existence of a
solution. 16/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
The class co-NP consists of problems for which a witness exists for every
instance with a negative response, and this witness can be checked in
polynomial time. The prevailing conjecture is that NP ̸= co-NP. If a
problem belongs to NP ∩ co-NP, it is viewed as evidence that the problem
cannot be NP-complete.
For instance, the problem of determining whether a number n has a prime
factor less than m can be demonstrated to lie in NP ∩ co-NP, indicating
that this problem is not considered NP-complete. In other words, factoring
is not deemed a highly challenging problem from a complexity-theoretic
perspective.
17/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Size of Witnesses in NP
One can explore the question of how small a witness for belonging to the
class NP can be. Consider the problem COMPOSITES, where the task is
to determine whether a given integer N is composite. As mentioned
earlier, this problem is evidently in the class NP. Different ways to prove
that N is composite include:
▶ Providing a factor: In this case, the size of the witness is O(log N).
▶ Supplying a Miller–Rabin witness a: Assuming the Generalized
Riemann Hypothesis (GRH), the size of the witness can be bounded
by O(log log N), as a ≤ O((log N)2 ).
18/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
21/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
23/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
24/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
25/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
26/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Explanation and Proof: Suppose we are given c and are asked to solve
c ≡ me (mod N), where this is considered a ”hard” problem instance.
The goal is to reduce this to an ”average” problem instance. This is
achieved by choosing s randomly from (Z/NZ)∗ and setting c ′ ≡ s · c. We
then attempt to solve c ′ ≡ m′e (mod N).
If we are unsuccessful in solving this new instance, we choose another
value of s and repeat the process until we encounter an ”average” type
problem that can be easily solved. If the average case was indeed easy, we
could solve c ′ ≡ m′e (mod N) for m′ and then set m ≡ m′ · s to find the
solution to the original problem c ≡ me (mod N).
27/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
29/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
One of the initial attempts in this direction was a public key cryptosystem
based on the knapsack or subset sum problem, known to be NP-complete.
However, it has been revealed that this knapsack-based scheme, along
with many others, is insecure. The underlying idea involves creating two
instances of the problem: a public one believed to be a general knapsack
problem and considered hard, and a private one designed to be easy.
Additionally, there should exist private trapdoor information that
transforms the hard problem into the easy one.
30/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
As an example, one could consider the set {2, 3, 6, 13, 27, 52}, or
alternatively, {1, 2, 4, 8, 16, 32, 64, . . .}. In a super-increasing knapsack
problem, characterized by an ordered set of such super-increasing weights
{w1 , . . . , wn }, along with a target weight S, the task of determining which
weights to place in the sack is a linear operation.
31/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
32/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
32/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
174 · 61 ≡ 9 ≡ 3 + 6 ≡ 011000,
280 · 61 ≡ 70 ≡ 2 + 3 + 13 + 52 ≡ 110101,
333 · 61 ≡ 48 ≡ 2 + 6 + 13 + 27 ≡ 101110.
Therefore, the decryption process successfully yields the original blocks of
the plaintext message.
34/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Final Decoding: The final decoding is done using the simple easy
knapsack, {2, 3, 6, 13, 27, 52}, and our earlier linear-time algorithm for
super-increasing knapsack problems.
Implementation Details: In a typical implementation, the knapsack
problem involves a larger number of items, often around 250, and the
values of N and M are usually chosen to be around 400 bits. However,
even with such parameters, the Merkle–Hellman encryption scheme can be
vulnerable to attacks using lattice-based techniques.
35/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
36/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
37/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
38/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Merkle–Hellman Cryptosystem
Key Generation
39/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Merkle–Hellman Cryptosystem
40/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Merkle–Hellman Cryptosystem
Decryption
174 · 61 ≡ 9 ≡ 3 + 6 ≡ 011000,
280 · 61 ≡ 70 ≡ 2 + 3 + 13 + 52 ≡ 110101,
333 · 61 ≡ 48 ≡ 2 + 6 + 13 + 27 ≡ 101110.
Therefore, the decryption process yields the original blocks of the plaintext
message.
41/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
42/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Frame Title
44/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Frame Title
To achieve this, we initiate the process by considering the lattice L(B) and
selecting a random vector x from this lattice, with the understanding that
L(B) contains infinitely many vectors. Subsequently, we introduce a
non-lattice vector close to x, specifically choosing an error vector e with a
Gaussian distribution featuring a mean of zero and a ”small” standard
deviation. Refer to Figure 17.1 for an illustrative example of the resulting
probability distribution in a two-dimensional lattice. As the standard
deviation increases progressively, we ultimately attain a distribution that
appears ”uniform” but maintains a connection to the original lattice basis
B, as depicted in Figure 17.2.
45/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
46/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Frame Title
46/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
47/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
48/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Continuing from the previous message, in the context of the SIVP problem,
√
the focus is on solving the problem for γ = 16 · n · m · c2 , where c2 is a
constant to be defined later. The input matrix for the SIVP problem is
denoted by B, where B consists of n column vectors {b1 , . . . , bn }. The
notation ∥B∥ represents the maximum norm of any column vector in B,
and the objective is to find a lattice basis with ∥B∥ ≤ γ · λn (L).
The strategy is to iteratively replace B with a basis B ′ having
∥B ′ ∥ ≤ ∥B∥/2. This replacement involves finding a vector y in the lattice
of size bounded by ∥B∥/2. If the output vector y is not independent of
the largest vector in B, the largest vector in B is replaced with the new
vector. This process results in a basis with a reduced value of ∥B∥, and
the procedure is repeated. The crucial observation is that the probability
of the output vector not being independent of the largest vector in B is
very small.
49/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Frame Title
51/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Proof Continuation
9. y ∈ L(B): The vector z obtained from the OSIS(A, q, β) oracle
satisfies A · z = 0 mod q. Thus, there exists w ∈ Zn such that
A · z = q · w . By rearranging terms, we have:
1 1 1 X X
B ·w = ·B ·(q·w ) = ·B ·A·z = ·B · ai ·zi = (ei +ui +vi )·zi .
q q q
Since B · w and vi are lattice vectors, y is also a lattice vector.
10. ∥y ∥ ≤ ∥B∥/2: This bound is established by combining two facts:
▶ ∥ui ∥ ≤ n · ∥B∥/q, as (ai , ei , ui , vi ) satisfies ei + ui + vi = q1 · B · ai .
√ √ √
▶ With high probability, ∥ei ∥ ≤ 2 · σ · n, where σ = n · ∥B∥/(2 · q).
Combining
P these facts and 1.5utilizing the fact that ∥z∥ ≤ β, we can
show ∥ (ei + ui ) · zi ∥ ≤ n · β · 2 · ∥B∥/q ≤ ∥B∥/2, based on the
chosen value of β.
This completes the explanation of the proof regarding y being a lattice
vector with a norm less than ∥B∥/2. The specific parameters and choices,
such as β, are crucial in ensuring the success of this reduction. 52/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
How large should σ be? The analysis indicates that the SIS oracle will
√
function effectively if we choose σ = n · ∥B∥ 2·q to be greater than or equal
to 2 · λn (L). However, this requirement implies that our input matrix B
must satisfy ∥B∥ > 4 · q · λ√n (L)
n
= γ · λn (L). Therefore, our reduction
approach will succeed as long as the basis adheres to this condition.
Consequently, the reduction process will conclude once we achieve
∥B∥ ≤ γ · λn (L), signifying the resolution of the input SIVPγ problem.
54/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
56/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
56/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
beamer []beamerthemedefault
57/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
57/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
beamer []beamerthemedefault
58/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
58/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Key Generation
Private Key: n
−q q
s← ,...,
2 2
Public Key:
For i = 1 to m :
q n
−q
ai ← ,...,
2 2
ei ← DZ 1,σ (Error values)
bi ← ai · s − 2 · ei mod q
Public key: pk ← {(a1 , b1 ), . . . , (am , bm )}
59/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Encryption
Encryption:
To encrypt a message (a single bit m ∈ {0, 1}), the encryptor selects a
subset of indicator bits in {1, . . . , ℓ}, i.e., θi ∈ {0, 1} for i = 1, . . . , ℓ. The
ciphertext is then the pair of values (consisting of a vector c and an
integer d):
For i = 1 to ℓ :
θi ← {0, 1}
Compute:
ℓ
X
c← θi · ai
i=1
ℓ
X
d ←m− θi · b i
i=1
60/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Decryption
Decryption:
Decryption of (c, d) is performed by evaluating
ℓ
!
X
( θi · ai · s + θi · bi ) + m mod q mod 2,
i=1
which simplifies to
ℓ
! !
X
2 · θi · ai · bi +m mod q mod 2,
i=1
62/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
General Design:
The public key contains numerous encryptions of zero. To encrypt a
message m, a subset of these zero encryptions is chosen and added to the
message, resulting in an encryption of m, provided that the ”noise” does
not become too large.
Security Assumption:
It can be demonstrated that the above scheme is IND-CPA
(Indistinguishability under Chosen-Plaintext Attack) assuming the hardness
of the LWE decision problem.
63/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS
Cryptography and Complexity Theory Decision and Search Problems (17.1.1)
Chapter Summary:
- Complexity theory focuses on the worst-case behavior of algorithms in
solving a given decision problem. Some problems are easy on average, but
there exist instances that are exceptionally challenging. - Problems like
RSA and DDH are hard on average, benefitting from random
self-reductions from a specific instance to a random instance of the
problem. - Cryptographic systems based on knapsack problems have faced
challenges, as lattice basis reduction techniques can often be employed to
break them. - For secure lattice-based systems, it is crucial to choose
lattice problems with worst-case to average-case reductions. - The
Learning With Errors (LWE) problem and the closely related Ring-LWE
problem are examples of such lattice problems that enable the construction
of fully homomorphic encryption schemes and schemes seemingly resistant
to quantum attacks.
64/64
İbrahim Doğa Sarı (METU-IAM) CRYPTOGRAPHY BASED ON REALLY HARD PROBLEMS