Further in the program
- Formulation of the knapsack problem (+ why a knapsack?)
- Easy and hard challenges
- Examples of
- History
What is public key encryption?
.
: , .
, - !
- , , «», .
- . , , , .
: , .
, - !
The first general public key algorithm used the knapsack algorithm.
Based on the definition of public key systems, it takes two keys to successfully encrypt (and decrypt) a message. The "legal" recipient of the message knows the secret keywhile the sender owns another public key ...
What to do if a public key becomes known to an attacker?
There is an answer: the public key must be obtained from the secret key using a transformation ( one-way function )with the following two properties:
- knowing A, it is easy to calculate the function itself
- , and it is difficult to calculate the inverse function
What is "easy" and "difficult"?
.
«» , . .. , —t ∝ n a , a — . , .
«» . , , .
..n , t ∝ 2 n , , .
«» , . .. , —
«» . , , .
..
The knapsack problem is formulated as follows
The set (backpack vector)
In the most famous version of the knapsack problem, it is required to find out whether a given pair has
Backpack analogy
In the simplest case
backpack is completely filled.
Ie, imagine that you have a set of weights 1, 6, 8, 15 and 24, you need to pack a backpack with a weight of 30.
In principle, a solution can always be found by exhaustive search of subsets
But what if there are several hundred numbers
In our example, n = 5 in order not to complicate the presentation. In real conditions, an example will have, say, 300
Does the function meet the specified requirements?
We define the function
That is,
Function
Encryption
Plain text
(. plain text) — , , . ( ).
You can encrypt in two ways:
- The message cipher is obtained by raising the elements of this knapsack vector to the power of the corresponding bits of the encrypted message and then multiplying all the results, that is, if
$ inline $ A = (2,3,5) $ inline $ and the message$ inline $ (100) $ inline $ , then the cipher will be the number$ inline $ 2 ^ 1 * 3 ^ 0 * 5 ^ 0 = 2 $ inline $ ... This is a multiplicative way. - The message cipher is obtained by multiplying the elements of this knapsack vector by the corresponding bits of the encrypted message and then summing up all the results, that is, if
$ inline $ A = (2,3,5) $ inline $ and the message$ inline $ (100) $ inline $ , then the cipher will be the number$ inline $ 2 ^ * 1 + 3 ^ * 0 + 5 ^ * 0 = 2 $ inline $ ... This method is called additive .
Example
To encrypt plaintext in binary representation, it is split into blocks of length
Backpack encryption provides a good approach to generating public and private keys, where the private key is easy to use and the public key is hard to figure out.
So, we can create a system where: the "hard" problem will serve as the
public key ; with it, you can easily encrypt and it is impossible to decrypt the message.
a private key - the "easy" problem will serve as using it, you can easily decrypt the message. Without the private key, you have to solve the "difficult" backpack problem.
"Easy" problem
Super growing backpack vector
A = ( a 1 , . . . , a n ) , Σ i = 1 j − 1 a i < a j j = 2 , . . . , n , . .
For super-growing vectors Α, the knapsack problem is easily solvable. Those. the backpack is easy to assemble.
Let's take an example:
Algorithm
- .
, , . , . - .
- (1)-(2) .
, .
"Difficult" problem
It is much more difficult to decipher the problem of a non-oversized backpack.
One algorithm, which uses an oversized private key backpack and a non-oversized public key backpack, was created by Merkle and Hellman.
They did this by taking the oversized backpack task and transforming it into a non-oversizing task.
(Merkle and Hellman, using modular arithmetic, devised a way to transform a "light" backpack into a "hard" one)
Create a public key
Several important concepts
-
( x , m o d m ) x ,m
— ,x , [x/m] — ,m > 1 x = ( x , m o d m ) + [ x / m ] ∗ m
-
,A m > m a x A ,t < m .( t , m ) = 1
,B = ( b 1 , . . . , b n ) ,b i = ( t a i , m o d m ) , , B A m t , ,i = 1 , . . . , n .( m , t )
( t , m ) = 1
, ,t − 1 = u
t u ≡ 1 ( m o d m )
. ,1 ≤ u < m A B
.m , u
-
m > m a x A
, ,m > Σ i = 1 n a i B A .m , t
- — , , , .
The creator of the cryptosystem chooses such a system
The message interceptor must solve the knapsack problem to enter
and solves the backpack entry problem
shown in the following lemma.
Lemma . Let's pretend that
(i) The knapsack problem
(ii) The knapsack problem
(iii) If there is a solution to enter
proof (p. 104)
Example
Consider a super-growing sequence; for example, {1, 2, 4, 10, 20, 40}. The modulus must be greater than the sum of all numbers in the sequence, for example 110. The multiplier must not have common divisors with the modulus. So let's pick 31.
So, we calculated the public key: {31, 62, 14, 90, 70, 30} and the private key - {1, 2, 4, 10, 20.40}.
Now let's try to send a binary sequence: 100100111100101110
Some of the benefits of public keys
- When using a public key cryptosystem, both parties do not meet, they may not even know each other and use any kind of communication.
- Key length. In symmetric cryptography, if the key is longer than the original message, no real gain is achieved. As for public key cryptosystems, the length of the encryption key does not matter, since it is public and public. Therefore, the length of the decryption key is not so important (the recipient only stores it in a secret place)
History
For a long time, backpack cryptosystems were considered as the most attractive and promising cryptosystems due to their NP-completeness and high encryption and decryption speed. Many schemes use the knapsack problem (in various variations), here are just a few of them: the compact knapsack problem, the multiplicative knapsack problem, the modular knapsack problem, the matrixcover problem, the group factorization problem ...
Unfortunately, most of them are vulnerable to attacks. It turned out that it is not trivial to design a secure cryptosystem based on the knapsack problem, although the problem is known as NP-complete. Most knapsack cryptosystems have been hacked. Despite this, in contrast to integer factorization and discrete logarithm, the general knapsack (solution) problem is a proven NP-complete problem.
Some people think that one day a polynomial-time algorithm could be invented to solve integer factorization and discrete logarithm problems, while the knapsack problem is still NP-complete.
There are several "BUTs" here.
First, NP-completeness is based on worst-case analysis; second, NP-completeness is a characteristic of a general problem, not a specific case. This means that if we consider the average complexity, the knapsack problem can be easy.
The material was prepared on the basis of this literature:
(1) A. Salomaa. Public-Key Cryptography. - Springer-Verlag, 1990. - p. 75-82, pp. 101-111
(2)Min Kin Lai. Knapsack Cryptosystems : Past and Future - University of California, 2001
(3) Baocang Wang, Qianhong Wu, Yupu Hu. A knapsack-based probabilistic encryption scheme. 2007
(4) - (5)