Merkle–Hellman Knapsack Cryptosystem
   HOME

TheInfoList



OR:

The Merkle–Hellman knapsack cryptosystem was one of the earliest
public key Public-key cryptography, or asymmetric cryptography, is the field of cryptographic systems that use pairs of related keys. Each key pair consists of a public key and a corresponding private key. Key pairs are generated with cryptographic alg ...
cryptosystems In cryptography, a cryptosystem is a suite of cryptographic algorithms needed to implement a particular security service, such as confidentiality (encryption). Typically, a cryptosystem consists of three algorithms: one for key generation, one for ...
. It was published by
Ralph Merkle Ralph C. Merkle (born February 2, 1952) is a computer scientist and mathematician. He is one of the inventors of public-key cryptography, the inventor of cryptographic hashing, and more recently a researcher and speaker on cryonics. Contribution ...
and
Martin Hellman Martin Edward Hellman (born October 2, 1945) is an American cryptologist and mathematician, best known for his involvement with public key cryptography in cooperation with Whitfield Diffie and Ralph Merkle. Hellman is a longtime contributor to th ...
in 1978. A polynomial time attack was published by
Adi Shamir Adi Shamir ( he, עדי שמיר; born July 6, 1952) is an Israeli cryptographer. He is a co-inventor of the Rivest–Shamir–Adleman (RSA) algorithm (along with Ron Rivest and Len Adleman), a co-inventor of the Feige–Fiat–Shamir identificat ...
in 1984. As a result, the cryptosystem is now considered insecure.


History

The concept of
public key cryptography Public-key cryptography, or asymmetric cryptography, is the field of cryptographic systems that use pairs of related keys. Each key pair consists of a public key and a corresponding private key. Key pairs are generated with cryptographic alg ...
was introduced by
Whitfield Diffie Bailey Whitfield 'Whit' Diffie (born June 5, 1944), ForMemRS, is an American cryptographer and mathematician and one of the pioneers of public-key cryptography along with Martin Hellman and Ralph Merkle. Diffie and Hellman's 1976 paper ''New Dire ...
and Martin Hellman in 1976. At that time they proposed the general concept of a "trap-door one-way function", a function whose inverse is computationally infeasible to calculate without some secret "trap-door information"; but they had not yet found a practical example of such a function. Several specific public-key cryptosystems were then proposed by other researchers over the next few years, such as RSA in 1977 and Merkle-Hellman in 1978.


Description

Merkle–Hellman is a public key cryptosystem, meaning that two keys are used, a public key for encryption and a private key for decryption. It is based on the
subset sum problem The subset sum problem (SSP) is a decision problem in computer science. In its most general formulation, there is a multiset S of integers and a target-sum T, and the question is to decide whether any subset of the integers sum to precisely T''.'' T ...
(a special case of the
knapsack problem The knapsack problem is a problem in combinatorial optimization: Given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given limit an ...
). The problem is as follows: given a set of integers A and an integer c, find a subset of A which sums to c. In general, this problem is known to be
NP-complete In computational complexity theory, a problem is NP-complete when: # it is a problem for which the correctness of each solution can be verified quickly (namely, in polynomial time) and a brute-force search algorithm can find a solution by tryi ...
. However, if A is superincreasing, meaning that each element of the set is greater than the sum of all the numbers in the set lesser than it, the problem is "easy" and solvable in polynomial time with a simple
greedy algorithm A greedy algorithm is any algorithm that follows the problem-solving heuristic of making the locally optimal choice at each stage. In many problems, a greedy strategy does not produce an optimal solution, but a greedy heuristic can yield locally ...
. In Merkle–Hellman, decrypting a message requires solving an apparently "hard" knapsack problem. The private key contains a superincreasing list of numbers W, and the public key contains a non-superincreasing list of numbers B, which is actually a "disguised" version of W. The private key also contains some "trapdoor" information that can be used to transform a hard knapsack problem using B into an easy knapsack problem using W. Unlike some other public key cryptosystems such as RSA, the two keys in Merkle-Hellman are not interchangeable; the private key cannot be used for encryption. Thus Merkle-Hellman is not directly usable for authentication by cryptographic signing, although Shamir published a variant that can be used for signing.


Key generation

1. Choose a block size n. Integers up to n bits in length can be encrypted with this key. 2. Choose a random superincreasing sequence of n
positive integers In mathematics, the natural numbers are those numbers used for counting (as in "there are ''six'' coins on the table") and ordering (as in "this is the ''third'' largest city in the country"). Numbers used for counting are called ''cardinal n ...
:W = ( w_1, w_2, \dots, w_n ) :The superincreasing requirement means that w_k > \sum_^ w_i, for 1 < k \le n. 3. Choose a random integer q such that : q > \sum_^n w_i 4. Choose a random integer r such that \gcd(r,q) = 1 (that is, r and q are
coprime In mathematics, two integers and are coprime, relatively prime or mutually prime if the only positive integer that is a divisor of both of them is 1. Consequently, any prime number that divides does not divide , and vice versa. This is equivale ...
). 5. Calculate the sequence :B = ( b_1, b_2, \dots, b_n ) :where b_i = r w_i \bmod q. The public key is B and the private key is (W,q,r).


Encryption

Let m be an n-bit message consisting of bits m_1 m_2 \dots m_n, with m_1 the highest order bit. Select each b_i for which m_i is nonzero, and add them together. Equivalently, calculate :c = \sum_^n m_i b_i. The ciphertext is c.


Decryption

To decrypt a ciphertext c, we must find the subset of B which sums to c. We do this by transforming the problem into one of finding a subset of W. That problem can be solved in polynomial time since W is superincreasing. 1. Calculate the
modular inverse In mathematics, particularly in the area of arithmetic, a modular multiplicative inverse of an integer is an integer such that the product is congruent to 1 with respect to the modulus .. In the standard notation of modular arithmetic this congru ...
of r modulo q using the
Extended Euclidean algorithm In arithmetic and computer programming, the extended Euclidean algorithm is an extension to the Euclidean algorithm, and computes, in addition to the greatest common divisor (gcd) of integers ''a'' and ''b'', also the coefficients of Bézout's ide ...
. The inverse will exist since r is coprime to q. :r' := r^ \pmod q :The computation of r' is independent of the message, and can be done just once when the private key is generated. 2. Calculate :c' := c r' \bmod q 3. Solve the subset sum problem for c' using the superincreasing sequence W, by the simple greedy algorithm described below. Let X = (x_1, x_2, \dots, x_k) be the resulting list of indexes of the elements of W which sum to c'. (That is, c' = \sum_^k w_.) 4. Construct the message m with a 1 in each x_i bit position and a 0 in all other bit positions: :m = \sum_^k 2^


Solving the subset sum problem

This simple greedy algorithm finds the subset of a superincreasing sequence W which sums to c', in polynomial time: :1. Initialize X to an empty list. :2. Find the largest element in W which is less than or equal to c', say w_j. :3. Subtract: c' := c' - w_j. :4. Append j to the list X. :5. If c' is greater than zero, return to step 2.


Example


Key generation

Create a key to encrypt 8-bit numbers by creating a random superincreasing sequence of 8 values: :W = ( 2, 7, 11, 21, 42, 89, 180, 354 ) The sum of these is 706, so select a larger value for q: :q = 881. Choose r to be coprime to q: :r = 588. Construct the public key B by multiplying each element in W by r modulo q: :\begin &(2 * 588) \bmod 881 = 295 \\ &(7 * 588) \bmod 881 = 592 \\ &(11 * 588) \bmod 881 = 301 \\ &(21 * 588) \bmod 881 = 14 \\ &(42 * 588) \bmod 881 = 28 \\ &(89 * 588) \bmod 881 = 353 \\ &(180 * 588) \bmod 881 = 120 \\ &(354 * 588) \bmod 881 = 236 \end Hence B = ( 295, 592, 301, 14, 28, 353, 120, 236 ).


Encryption

Let the 8-bit message be m = 97 = 01100001_2. We multiply each bit by the corresponding number in B and add the results: 0 * 295 + 1 * 592 + 1 * 301 + 0 * 14 + 0 * 28 + 0 * 353 + 0 * 120 + 1 * 236 = 1129 The ciphertext c is 1129.


Decryption

To decrypt 1129, first use the Extended Euclidean Algorithm to find the modular inverse of r mod q: :r' = r^ \bmod q = 588^ \bmod 881 = 442. Compute c' = c r' \bmod q = 1129*442 \bmod 881 = 372. Use the greedy algorithm to decompose 372 into a sum of w_i values: :\begin c' &= 372 \\ & w_8 = 354 \le 372 \\ c' &= 372-354 = 18 \\ & w_3 = 11 \le 18 \\ c' &= 18-11 = 7 \\ & w_2 = 7 \le 7 \\ c' &= 7-7 = 0 \end Thus 372 = 354 + 11 + 7 = w_8 + w_3 + w_2, and the list of indexes is X = (8,3,2). The message can now be computed as :m = \sum_^3 2^ = 2^ + 2^ + 2^ = 1 + 32 + 64 = 97.


Cryptanalysis

In 1984 Adi Shamir published an attack on the Merkle-Hellman cryptosystem which can decrypt encrypted messages in polynomial time without using the private key. The attack analyzes the public key B = (b_1, b_2, \dots, b_n) and searches for a pair of numbers u and m such that (u b_i \bmod m) is a superincreasing sequence. The (u,m) pair found by the attack may not be equal to (r',q) in the private key, but like that pair it can be used to transform a hard knapsack problem using B into an easy problem using a superincreasing sequence. The attack operates solely on the public key; no access to encrypted messages is necessary.


References

{{DEFAULTSORT:Merkle-Hellman Knapsack Cryptosystem Public-key encryption schemes Broken cryptography algorithms