Knapsack Algorithm Ralph Merkle and Martin Hellman Developed The First Algorithm For
Knapsack Algorithm Ralph Merkle and Martin Hellman Developed The First Algorithm For
Ralph Merkle and Martin Hellman developed the first algorithm for
public key encryption, called as the Knapsack algorithm. It is based on
the Knapsack problem. This is actually a simple problem. Given a pile of
items, each with different weights, is it possible to put some of them in a
bag (i.e. knapsack) in such a way that the knapsack has a certain weight?
That is, if M1, M2, ..., Mn are the given values and S is the sum, find out bi
so that: S = b1M1 + b2M2 + ... + bnMn, each bi can be 0 or 1. A 1
indicates that the item is in the knapsack and a O indicates that it is not.
A block of plain text equal in length to the number of items in the pile
would select the items in the knapsack. The cipher text is the resulting
sum. For example, if the knapsack is 1, 7, 8, 12, 14, 20, then the plain text
and the resulting cipher text is as shown in Fig.
Knapsack steps:
First we have to choose a super-increasing knapsack (to use as the
private key) with which to encrypt our data.
I want to encrypt [0110 11111 0000 10110] in to cipher text for
that we break the binary data in to blocks that are the length of our
knapsack.
Our knapsack is {1 7 8 12 14 20} , the length is 6.
Blocks are [011011 111000 010110]
If we look at the first block (011011), there are 1s in the second,
third, fifth and sixth positions. This means that we take the second,
third, fifth and sixth positions numbers in our public key, and add
them together.