<s>
The	O
Solitaire	B-Algorithm
cryptographic	O
algorithm	O
was	O
designed	O
by	O
Bruce	O
Schneier	O
at	O
the	O
request	O
of	O
Neal	O
Stephenson	O
for	O
use	O
in	O
his	O
novel	O
Cryptonomicon	O
,	O
in	O
which	O
field	O
agents	O
use	O
it	O
to	O
communicate	O
securely	O
without	O
having	O
to	O
rely	O
on	O
electronics	O
or	O
having	O
to	O
carry	O
incriminating	O
tools	O
.	O
</s>
<s>
It	O
was	O
designed	O
to	O
be	O
a	O
manual	O
cryptosystem	B-General_Concept
calculated	O
with	O
an	O
ordinary	O
deck	O
of	O
playing	O
cards	O
.	O
</s>
<s>
One	O
of	O
the	O
motivations	O
behind	O
Solitaire	B-Algorithm
's	O
creation	O
is	O
that	O
in	O
totalitarian	O
environments	O
,	O
a	O
deck	O
of	O
cards	O
is	O
far	O
more	O
affordable	O
(	O
and	O
less	O
incriminating	O
)	O
than	O
a	O
personal	O
computer	O
with	O
an	O
array	O
of	O
cryptological	O
utilities	O
.	O
</s>
<s>
The	O
algorithm	O
generates	O
a	O
keystream	B-Algorithm
,	O
a	O
sequence	O
of	O
values	O
which	O
are	O
combined	O
with	O
the	O
message	O
to	O
encrypt	O
and	O
decrypt	O
it	O
.	O
</s>
<s>
Each	O
value	O
of	O
the	O
keystream	B-Algorithm
is	O
used	O
to	O
encrypt	O
one	O
character	O
of	O
the	O
message	O
,	O
so	O
the	O
keystream	B-Algorithm
must	O
be	O
at	O
least	O
as	O
long	O
as	O
the	O
message	O
.	O
</s>
<s>
If	O
the	O
keystream	B-Algorithm
is	O
longer	O
than	O
the	O
message	O
,	O
the	O
message	O
may	O
be	O
padded	O
with	O
an	O
additional	O
repeated	O
character	O
,	O
thus	O
denying	O
the	O
attacker	O
knowledge	O
of	O
the	O
exact	O
length	O
of	O
the	O
message	O
.	O
</s>
<s>
Generate	O
one	O
keystream	B-Algorithm
value	O
for	O
each	O
letter	O
in	O
the	O
message	O
using	O
the	O
keystream	B-Algorithm
algorithm	O
below	O
.	O
</s>
<s>
Add	O
each	O
keystream	B-Algorithm
value	O
to	O
the	O
corresponding	O
plaintext	O
number	O
,	O
subtracting	O
26	O
if	O
the	O
resulting	O
value	O
is	O
greater	O
than	O
26	O
.	O
</s>
<s>
Generate	O
one	O
keystream	B-Algorithm
value	O
for	O
each	O
letter	O
in	O
the	O
ciphertext	O
.	O
</s>
<s>
Subtract	O
each	O
keystream	B-Algorithm
value	O
from	O
the	O
corresponding	O
ciphertext	O
value	O
,	O
adding	O
26	O
if	O
the	O
resulting	O
value	O
is	O
less	O
than	O
1	O
.	O
</s>
<s>
This	O
algorithm	O
generates	O
keystream	B-Algorithm
values	O
by	O
moving	O
cards	O
within	O
the	O
deck	O
.	O
</s>
<s>
The	O
keystream	B-Algorithm
algorithm	O
is	O
deterministic	O
,	O
so	O
the	O
keystream	B-Algorithm
values	O
depend	O
only	O
on	O
the	O
initial	O
order	O
of	O
the	O
deck	O
.	O
</s>
<s>
Perform	O
these	O
steps	O
to	O
generate	O
one	O
character	O
of	O
the	O
keystream	B-Algorithm
.	O
</s>
<s>
Count	O
this	O
many	O
places	O
below	O
that	O
card	O
and	O
take	O
the	O
value	O
of	O
that	O
card	O
as	O
the	O
next	O
value	O
in	O
the	O
keystream	B-Algorithm
.	O
</s>
<s>
If	O
the	O
card	O
counted	O
to	O
is	O
either	O
joker	O
,	O
ignore	O
it	O
and	O
repeat	O
the	O
keystream	B-Algorithm
algorithm	O
.	O
</s>
<s>
In	O
this	O
example	O
the	O
top	O
card	O
is	O
23	O
,	O
so	O
we	O
count	O
to	O
the	O
24th	O
card	O
,	O
which	O
is	O
11	O
;	O
thus	O
,	O
the	O
keystream	B-Algorithm
value	O
is	O
11	O
.	O
</s>
<s>
(	O
Note	O
that	O
no	O
cards	O
change	O
places	O
in	O
this	O
step	O
,	O
this	O
step	O
simply	O
determines	O
the	O
keystream	B-Algorithm
value	O
)	O
.	O
</s>
<s>
In	O
1999	O
Paul	O
Crowley	O
discovered	O
that	O
there	O
is	O
a	O
bias	O
towards	O
repeating	O
characters	O
in	O
the	O
keystream	B-Algorithm
,	O
which	O
occur	O
about	O
every	O
1/22.5	O
characters	O
rather	O
than	O
the	O
expected	O
1/26	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
Solitaire	B-Algorithm
leaks	O
information	O
at	O
a	O
rate	O
of	O
about	O
0.0005	O
bits	O
per	O
character	O
.	O
</s>
<s>
While	O
its	O
security	O
may	O
perhaps	O
be	O
adequate	O
for	O
very	O
short	O
messages	O
,	O
in	O
general	O
Solitaire	B-Algorithm
is	O
considered	O
insecure	O
.	O
</s>
<s>
Crowley	O
also	O
noticed	O
that	O
in	O
some	O
cases	O
,	O
there	O
are	O
two	O
different	O
deck	O
configurations	O
which	O
result	O
in	O
the	O
same	O
configuration	O
after	O
executing	O
the	O
keystream	B-Algorithm
algorithm	O
.	O
</s>
