<s>
In	O
cryptography	O
,	O
a	O
Lamport	B-Algorithm
signature	I-Algorithm
or	O
Lamport	O
one-time	B-Algorithm
signature	I-Algorithm
scheme	O
is	O
a	O
method	O
for	O
constructing	O
a	O
digital	O
signature	O
.	O
</s>
<s>
Lamport	B-Algorithm
signatures	I-Algorithm
can	O
be	O
built	O
from	O
any	O
cryptographically	O
secure	O
one-way	O
function	O
;	O
usually	O
a	O
cryptographic	B-Algorithm
hash	I-Algorithm
function	I-Algorithm
is	O
used	O
.	O
</s>
<s>
Although	O
the	O
potential	O
development	O
of	O
quantum	B-Architecture
computers	I-Architecture
threatens	O
the	O
security	O
of	O
many	O
common	O
forms	O
of	O
cryptography	O
such	O
as	O
RSA	B-Architecture
,	O
it	O
is	O
believed	O
that	O
Lamport	B-Algorithm
signatures	I-Algorithm
with	O
large	O
hash	B-Algorithm
functions	I-Algorithm
would	O
still	O
be	O
secure	O
in	O
that	O
event	O
.	O
</s>
<s>
However	O
,	O
many	O
Lamport	B-Algorithm
signatures	I-Algorithm
can	O
be	O
handled	O
by	O
one	O
Merkle	B-Algorithm
hash	I-Algorithm
tree	I-Algorithm
,	O
thus	O
a	O
single	O
hash	B-Algorithm
tree	I-Algorithm
key	O
can	O
be	O
used	O
for	O
many	O
messages	O
,	O
making	O
this	O
a	O
fairly	O
efficient	O
digital	O
signature	O
scheme	O
.	O
</s>
<s>
The	O
Lamport	B-Algorithm
signature	I-Algorithm
cryptosystem	O
was	O
invented	O
in	O
1979	O
and	O
named	O
after	O
its	O
inventor	O
,	O
Leslie	O
Lamport	O
.	O
</s>
<s>
Alice	O
has	O
a	O
256-bit	O
cryptographic	B-Algorithm
hash	I-Algorithm
function	I-Algorithm
and	O
some	O
kind	O
of	O
secure	O
random	O
number	O
generator	O
.	O
</s>
<s>
To	O
create	O
the	O
public	O
key	O
she	O
hashes	B-Algorithm
each	O
of	O
the	O
512	O
random	O
numbers	O
in	O
the	O
private	O
key	O
,	O
thus	O
creating	O
512	O
hashes	B-Algorithm
,	O
each	O
256	O
bits	O
in	O
size	O
.	O
</s>
<s>
These	O
512	O
hashes	B-Algorithm
form	O
her	O
public	O
key	O
,	O
which	O
she	O
will	O
share	O
with	O
the	O
world	O
.	O
</s>
<s>
First	O
she	O
hashes	B-Algorithm
the	O
message	O
to	O
a	O
256-bit	O
hash	B-Algorithm
sum	O
.	O
</s>
<s>
Then	O
,	O
for	O
each	O
bit	O
in	O
the	O
hash	B-Algorithm
,	O
based	O
on	O
the	O
value	O
of	O
the	O
bit	O
,	O
she	O
picks	O
one	O
number	O
from	O
the	O
corresponding	O
pairs	O
of	O
numbers	O
that	O
make	O
up	O
her	O
private	O
key	O
(	O
i.e.	O
,	O
if	O
the	O
bit	O
is	O
0	O
,	O
the	O
first	O
number	O
is	O
chosen	O
,	O
and	O
if	O
the	O
bit	O
is	O
1	O
,	O
the	O
second	O
is	O
chosen	O
)	O
.	O
</s>
<s>
He	O
also	O
hashes	B-Algorithm
the	O
message	O
to	O
get	O
a	O
256-bit	O
hash	B-Algorithm
sum	O
.	O
</s>
<s>
Then	O
he	O
uses	O
the	O
bits	O
in	O
the	O
hash	B-Algorithm
sum	O
to	O
pick	O
out	O
256	O
of	O
the	O
hashes	B-Algorithm
in	O
Alice	O
's	O
public	O
key	O
.	O
</s>
<s>
He	O
picks	O
the	O
hashes	B-Algorithm
in	O
the	O
same	O
manner	O
that	O
Alice	O
picked	O
the	O
random	O
numbers	O
for	O
the	O
signature	O
.	O
</s>
<s>
That	O
is	O
,	O
if	O
the	O
first	O
bit	O
of	O
the	O
message	O
hash	B-Algorithm
is	O
a	O
0	O
,	O
he	O
picks	O
the	O
first	O
hash	B-Algorithm
in	O
the	O
first	O
pair	O
,	O
and	O
so	O
on	O
.	O
</s>
<s>
Then	O
Bob	O
hashes	B-Algorithm
each	O
of	O
the	O
256	O
random	O
numbers	O
in	O
Alice	O
's	O
signature	O
.	O
</s>
<s>
This	O
gives	O
him	O
256	O
hashes	B-Algorithm
.	O
</s>
<s>
If	O
these	O
256	O
hashes	B-Algorithm
exactly	O
match	O
the	O
256	O
hashes	B-Algorithm
he	O
just	O
picked	O
from	O
Alice	O
's	O
public	O
key	O
then	O
the	O
signature	O
is	O
ok	O
.	O
</s>
<s>
And	O
after	O
Alice	O
has	O
published	O
the	O
signature	O
,	O
others	O
still	O
do	O
not	O
know	O
the	O
other	O
256	O
random	O
numbers	O
and	O
thus	O
can	O
not	O
create	O
signatures	O
that	O
fit	O
other	O
message	O
hashes	B-Algorithm
.	O
</s>
<s>
Below	O
is	O
a	O
short	O
description	O
of	O
how	O
Lamport	B-Algorithm
signatures	I-Algorithm
work	O
,	O
written	O
in	O
mathematical	O
notation	O
.	O
</s>
<s>
Note	O
that	O
the	O
"	O
message	O
"	O
in	O
this	O
description	O
is	O
a	O
fixed	O
sized	O
block	O
of	O
reasonable	O
size	O
,	O
possibly	O
(	O
but	O
not	O
necessarily	O
)	O
the	O
hash	B-Algorithm
result	O
of	O
an	O
arbitrarily	O
long	O
message	O
being	O
signed	O
.	O
</s>
<s>
The	O
security	O
of	O
Lamport	B-Algorithm
signatures	I-Algorithm
is	O
based	O
on	O
the	O
security	O
of	O
the	O
one-way	B-Algorithm
hash	I-Algorithm
function	I-Algorithm
and	O
the	O
length	O
of	O
its	O
output	O
.	O
</s>
<s>
For	O
a	O
hash	B-Algorithm
function	I-Algorithm
that	O
generates	O
an	O
n-bit	O
message	B-Algorithm
digest	I-Algorithm
,	O
the	O
ideal	O
preimage	O
and	O
2nd	O
preimage	O
resistance	O
on	O
a	O
single	O
hash	B-Algorithm
function	I-Algorithm
invocation	O
implies	O
on	O
the	O
order	O
of	O
2n	O
operations	O
to	O
find	O
a	O
collision	O
under	O
a	O
classical	O
computing	O
model	O
.	O
</s>
<s>
According	O
to	O
Grover	B-Algorithm
's	I-Algorithm
algorithm	I-Algorithm
,	O
finding	O
a	O
preimage	O
collision	O
on	O
a	O
single	O
invocation	O
of	O
an	O
ideal	O
hash	B-Algorithm
function	I-Algorithm
is	O
upper	O
bound	O
on	O
O( 	O
2n/2	O
)	O
operations	O
under	O
a	O
quantum	B-Architecture
computing	I-Architecture
model	O
.	O
</s>
<s>
In	O
Lamport	B-Algorithm
signatures	I-Algorithm
,	O
each	O
bit	O
of	O
the	O
public	O
key	O
and	O
signature	O
is	O
based	O
on	O
short	O
messages	O
requiring	O
only	O
a	O
single	O
invocation	O
to	O
a	O
hash	B-Algorithm
function	I-Algorithm
.	O
</s>
<s>
For	O
example	O
,	O
in	O
a	O
degenerate	O
case	O
,	O
if	O
each	O
private	O
key	O
yi	O
,	O
j	O
element	O
was	O
only	O
16	O
bits	O
in	O
length	O
,	O
it	O
is	O
trivial	O
to	O
exhaustively	O
search	O
all	O
216	O
possible	O
private	O
key	O
combinations	O
in	O
216	O
operations	O
to	O
find	O
a	O
match	O
with	O
the	O
output	O
,	O
irrespective	O
of	O
the	O
message	B-Algorithm
digest	I-Algorithm
length	O
.	O
</s>
<s>
Based	O
on	O
Grover	B-Algorithm
's	I-Algorithm
algorithm	I-Algorithm
,	O
a	O
quantum	O
secure	O
system	O
,	O
the	O
length	O
of	O
the	O
public	O
key	O
elements	O
zi	O
,	O
j	O
,	O
the	O
private	O
key	O
elements	O
yi	O
,	O
j	O
and	O
the	O
signature	O
elements	O
si	O
,	O
j	O
must	O
be	O
no	O
less	O
than	O
2	O
times	O
larger	O
than	O
the	O
security	O
rating	O
of	O
the	O
system	O
.	O
</s>
<s>
However	O
caution	O
should	O
be	O
taken	O
as	O
the	O
idealistic	O
work	O
estimates	O
above	O
assume	O
an	O
ideal	O
(	O
perfect	O
)	O
hash	B-Algorithm
function	I-Algorithm
and	O
are	O
limited	O
to	O
attacks	O
that	O
target	O
only	O
a	O
single	O
preimage	O
at	O
a	O
time	O
.	O
</s>
<s>
Selecting	O
the	O
optimum	O
element	O
size	O
taking	O
into	O
account	O
the	O
collection	O
of	O
multiple	O
message	B-Algorithm
digests	I-Algorithm
is	O
an	O
open	O
problem	O
.	O
</s>
<s>
Selection	O
of	O
larger	O
element	O
sizes	O
and	O
stronger	O
hash	B-Algorithm
functions	I-Algorithm
,	O
such	O
as	O
512-bit	O
elements	O
and	O
SHA-512	O
,	O
ensures	O
greater	O
security	O
margins	O
to	O
manage	O
these	O
unknowns	O
.	O
</s>
<s>
The	O
single	O
key	O
can	O
then	O
be	O
used	O
as	O
the	O
seed	O
for	O
a	O
cryptographically	B-Algorithm
secure	I-Algorithm
pseudorandom	I-Algorithm
number	I-Algorithm
generator	I-Algorithm
(	O
CSPRNG	B-Algorithm
)	O
to	O
create	O
all	O
the	O
random	O
numbers	O
in	O
the	O
private	O
key	O
when	O
needed	O
.	O
</s>
<s>
Note	O
a	O
cryptographically	O
secure	O
hash	B-Algorithm
(	O
or	O
at	O
least	O
whose	O
output	O
is	O
not	O
XORed	O
with	O
the	O
seed	O
)	O
can	O
not	O
be	O
used	O
instead	O
of	O
CSPRNG	B-Algorithm
because	O
signing	O
a	O
message	O
would	O
reveal	O
additional	O
random	O
values	O
from	O
the	O
private	O
key	O
.	O
</s>
<s>
In	O
the	O
same	O
manner	O
a	O
single	O
key	O
can	O
be	O
used	O
together	O
with	O
a	O
CSPRNG	B-Algorithm
to	O
create	O
many	O
Lamport	O
keys	O
.	O
</s>
<s>
Preferably	O
then	O
some	O
kind	O
of	O
random	B-General_Concept
access	I-General_Concept
CSPRNG	B-Algorithm
should	O
be	O
used	O
,	O
such	O
as	O
BBS	B-Algorithm
.	O
</s>
<s>
A	O
Lamport	B-Algorithm
signature	I-Algorithm
can	O
be	O
combined	O
with	O
a	O
hash	B-Algorithm
list	I-Algorithm
,	O
making	O
it	O
possible	O
to	O
publish	O
only	O
the	O
single	O
top	O
hash	B-Algorithm
instead	O
of	O
all	O
the	O
hashes	B-Algorithm
in	O
the	O
public	O
key	O
.	O
</s>
<s>
To	O
verify	O
against	O
the	O
single	O
top	O
hash	B-Algorithm
,	O
the	O
signature	O
must	O
include	O
the	O
random	O
numbers	O
and	O
the	O
unused	O
hashes	B-Algorithm
from	O
the	O
hash	B-Algorithm
list	I-Algorithm
of	O
the	O
public	O
key	O
,	O
resulting	O
in	O
signatures	O
of	O
about	O
twice	O
the	O
size	O
.	O
</s>
<s>
The	O
unused	O
hashes	B-Algorithm
do	O
not	O
need	O
to	O
be	O
included	O
in	O
the	O
signature	O
if	O
a	O
cryptographic	O
accumulator	O
is	O
used	O
instead	O
of	O
a	O
hash	B-Algorithm
list	I-Algorithm
.	O
</s>
<s>
A	O
cryptographically	O
secure	O
hash	B-Algorithm
suffices	O
instead	O
of	O
the	O
requirement	O
for	O
a	O
CSPRNG	B-Algorithm
.	O
</s>
<s>
A	O
hash	B-Algorithm
list	I-Algorithm
could	O
also	O
be	O
employed	O
to	O
shorten	O
the	O
public	O
key	O
to	O
a	O
single	O
value	O
at	O
the	O
expense	O
of	O
doubling	O
the	O
size	O
of	O
the	O
signature	O
as	O
explained	O
in	O
the	O
prior	O
section	O
.	O
</s>
<s>
But	O
a	O
hash	B-Algorithm
tree	I-Algorithm
can	O
be	O
used	O
on	O
those	O
public	O
keys	O
,	O
publishing	O
the	O
top	O
hash	B-Algorithm
of	O
the	O
hash	B-Algorithm
tree	I-Algorithm
instead	O
.	O
</s>
<s>
This	O
increases	O
the	O
size	O
of	O
the	O
resulting	O
signature	O
,	O
since	O
a	O
branch	O
of	O
the	O
hash	B-Algorithm
tree	I-Algorithm
has	O
to	O
be	O
included	O
in	O
the	O
signature	O
,	O
but	O
it	O
makes	O
it	O
possible	O
to	O
publish	O
a	O
single	O
hash	B-Algorithm
that	O
then	O
can	O
be	O
used	O
to	O
verify	O
a	O
large	O
number	O
of	O
future	O
signatures	O
.	O
</s>
