<s>
The	O
Merkle	B-Algorithm
–	I-Algorithm
Hellman	I-Algorithm
knapsack	I-Algorithm
cryptosystem	I-Algorithm
was	O
one	O
of	O
the	O
earliest	O
public	B-Application
key	I-Application
cryptosystems	I-Application
.	O
</s>
<s>
The	O
concept	O
of	O
public	B-Application
key	I-Application
cryptography	I-Application
was	O
introduced	O
by	O
Whitfield	O
Diffie	O
and	O
Martin	O
Hellman	O
in	O
1976	O
.	O
</s>
<s>
Several	O
specific	O
public-key	B-Application
cryptosystems	I-Application
were	O
then	O
proposed	O
by	O
other	O
researchers	O
over	O
the	O
next	O
few	O
years	O
,	O
such	O
as	O
RSA	B-Architecture
in	O
1977	O
and	O
Merkle-Hellman	B-Algorithm
in	O
1978	O
.	O
</s>
<s>
Merkle	O
–	O
Hellman	O
is	O
a	O
public	B-Application
key	I-Application
cryptosystem	I-Application
,	O
meaning	O
that	O
two	O
keys	O
are	O
used	O
,	O
a	O
public	B-Application
key	I-Application
for	O
encryption	O
and	O
a	O
private	B-Application
key	I-Application
for	O
decryption	O
.	O
</s>
<s>
It	O
is	O
based	O
on	O
the	O
subset	B-Algorithm
sum	I-Algorithm
problem	I-Algorithm
(	O
a	O
special	O
case	O
of	O
the	O
knapsack	B-Algorithm
problem	I-Algorithm
)	O
.	O
</s>
<s>
However	O
,	O
if	O
is	O
superincreasing	B-General_Concept
,	O
meaning	O
that	O
each	O
element	O
of	O
the	O
set	O
is	O
greater	O
than	O
the	O
sum	O
of	O
all	O
the	O
numbers	O
in	O
the	O
set	O
lesser	O
than	O
it	O
,	O
the	O
problem	O
is	O
"	O
easy	O
"	O
and	O
solvable	O
in	O
polynomial	O
time	O
with	O
a	O
simple	O
greedy	B-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
In	O
Merkle	O
–	O
Hellman	O
,	O
decrypting	O
a	O
message	O
requires	O
solving	O
an	O
apparently	O
"	O
hard	O
"	O
knapsack	B-Algorithm
problem	I-Algorithm
.	O
</s>
<s>
The	O
private	B-Application
key	I-Application
contains	O
a	O
superincreasing	B-General_Concept
list	O
of	O
numbers	O
,	O
and	O
the	O
public	B-Application
key	I-Application
contains	O
a	O
non-superincreasing	O
list	O
of	O
numbers	O
,	O
which	O
is	O
actually	O
a	O
"	O
disguised	O
"	O
version	O
of	O
.	O
</s>
<s>
The	O
private	B-Application
key	I-Application
also	O
contains	O
some	O
"	O
trapdoor	O
"	O
information	O
that	O
can	O
be	O
used	O
to	O
transform	O
a	O
hard	O
knapsack	B-Algorithm
problem	I-Algorithm
using	O
into	O
an	O
easy	O
knapsack	B-Algorithm
problem	I-Algorithm
using	O
.	O
</s>
<s>
Unlike	O
some	O
other	O
public	B-Application
key	I-Application
cryptosystems	I-Application
such	O
as	O
RSA	B-Architecture
,	O
the	O
two	O
keys	O
in	O
Merkle-Hellman	B-Algorithm
are	O
not	O
interchangeable	O
;	O
the	O
private	B-Application
key	I-Application
cannot	O
be	O
used	O
for	O
encryption	O
.	O
</s>
<s>
Thus	O
Merkle-Hellman	B-Algorithm
is	O
not	O
directly	O
usable	O
for	O
authentication	O
by	O
cryptographic	O
signing	O
,	O
although	O
Shamir	O
published	O
a	O
variant	O
that	O
can	O
be	O
used	O
for	O
signing	O
.	O
</s>
<s>
The	O
superincreasing	B-General_Concept
requirement	O
means	O
that	O
,	O
for	O
.	O
</s>
<s>
The	O
public	B-Application
key	I-Application
is	O
and	O
the	O
private	B-Application
key	I-Application
is	O
.	O
</s>
<s>
That	O
problem	O
can	O
be	O
solved	O
in	O
polynomial	O
time	O
since	O
is	O
superincreasing	B-General_Concept
.	O
</s>
<s>
The	O
computation	O
of	O
is	O
independent	O
of	O
the	O
message	O
,	O
and	O
can	O
be	O
done	O
just	O
once	O
when	O
the	O
private	B-Application
key	I-Application
is	O
generated	O
.	O
</s>
<s>
Solve	O
the	O
subset	B-Algorithm
sum	I-Algorithm
problem	I-Algorithm
for	O
using	O
the	O
superincreasing	B-General_Concept
sequence	I-General_Concept
,	O
by	O
the	O
simple	O
greedy	B-Algorithm
algorithm	I-Algorithm
described	O
below	O
.	O
</s>
<s>
This	O
simple	O
greedy	B-Algorithm
algorithm	I-Algorithm
finds	O
the	O
subset	O
of	O
a	O
superincreasing	B-General_Concept
sequence	I-General_Concept
which	O
sums	O
to	O
,	O
in	O
polynomial	O
time	O
:	O
</s>
<s>
Create	O
a	O
key	O
to	O
encrypt	O
8-bit	O
numbers	O
by	O
creating	O
a	O
random	O
superincreasing	B-General_Concept
sequence	I-General_Concept
of	O
8	O
values	O
:	O
</s>
<s>
Construct	O
the	O
public	B-Application
key	I-Application
by	O
multiplying	O
each	O
element	O
in	O
by	O
modulo	O
:	O
</s>
<s>
Use	O
the	O
greedy	B-Algorithm
algorithm	I-Algorithm
to	O
decompose	O
372	O
into	O
a	O
sum	O
of	O
values	O
:	O
</s>
<s>
In	O
1984	O
Adi	O
Shamir	O
published	O
an	O
attack	O
on	O
the	O
Merkle-Hellman	B-Algorithm
cryptosystem	O
which	O
can	O
decrypt	O
encrypted	O
messages	O
in	O
polynomial	O
time	O
without	O
using	O
the	O
private	B-Application
key	I-Application
.	O
</s>
<s>
The	O
attack	O
analyzes	O
the	O
public	B-Application
key	I-Application
and	O
searches	O
for	O
a	O
pair	O
of	O
numbers	O
and	O
such	O
that	O
is	O
a	O
superincreasing	B-General_Concept
sequence	I-General_Concept
.	O
</s>
<s>
The	O
pair	O
found	O
by	O
the	O
attack	O
may	O
not	O
be	O
equal	O
to	O
in	O
the	O
private	B-Application
key	I-Application
,	O
but	O
like	O
that	O
pair	O
it	O
can	O
be	O
used	O
to	O
transform	O
a	O
hard	O
knapsack	B-Algorithm
problem	I-Algorithm
using	O
into	O
an	O
easy	O
problem	O
using	O
a	O
superincreasing	B-General_Concept
sequence	I-General_Concept
.	O
</s>
<s>
The	O
attack	O
operates	O
solely	O
on	O
the	O
public	B-Application
key	I-Application
;	O
no	O
access	O
to	O
encrypted	O
messages	O
is	O
necessary	O
.	O
</s>
<s>
Shamir	O
's	O
attack	O
on	O
the	O
Merkle-Hellman	B-Algorithm
cryptosystem	O
works	O
in	O
polynomial	O
time	O
even	O
if	O
the	O
numbers	O
in	O
the	O
public	B-Application
key	I-Application
are	O
randomly	O
shuffled	O
,	O
a	O
step	O
which	O
is	O
usually	O
not	O
included	O
in	O
the	O
description	O
of	O
the	O
cryptosystem	O
,	O
but	O
can	O
be	O
helpful	O
against	O
some	O
more	O
primitive	O
attacks	O
.	O
</s>
