<s>
Serpent	B-Algorithm
is	O
a	O
symmetric	B-Algorithm
key	I-Algorithm
block	O
cipher	B-Application
that	O
was	O
a	O
finalist	O
in	O
the	O
Advanced	B-Algorithm
Encryption	I-Algorithm
Standard	I-Algorithm
(	O
AES	B-Algorithm
)	O
contest	O
,	O
where	O
it	O
was	O
ranked	O
second	O
to	O
Rijndael	B-Algorithm
.	O
</s>
<s>
Serpent	B-Algorithm
was	O
designed	O
by	O
Ross	O
Anderson	O
,	O
Eli	O
Biham	O
,	O
and	O
Lars	O
Knudsen	O
.	O
</s>
<s>
Like	O
other	O
AES	B-Algorithm
submissions	O
,	O
Serpent	B-Algorithm
has	O
a	O
block	O
size	O
of	O
128	O
bits	O
and	O
supports	O
a	O
key	O
size	O
of	O
128	O
,	O
192	O
or	O
256	O
bits	O
.	O
</s>
<s>
The	O
cipher	B-Application
is	O
a	O
32-round	O
substitution	B-Algorithm
–	I-Algorithm
permutation	I-Algorithm
network	I-Algorithm
operating	O
on	O
a	O
block	O
of	O
four	O
32-bit	O
words	O
.	O
</s>
<s>
Each	O
round	O
applies	O
one	O
of	O
eight	O
4-bit	O
to	O
4-bit	O
S-boxes	B-Algorithm
32	O
times	O
in	O
parallel	B-Operating_System
.	O
</s>
<s>
Serpent	B-Algorithm
was	O
designed	O
so	O
that	O
all	O
operations	O
can	O
be	O
executed	O
in	O
parallel	B-Operating_System
,	O
using	O
32	O
bit	B-General_Concept
slices	I-General_Concept
.	O
</s>
<s>
This	O
maximizes	O
parallelism	B-Operating_System
,	O
but	O
also	O
allows	O
use	O
of	O
the	O
extensive	O
cryptanalysis	O
work	O
performed	O
on	O
DES	B-Algorithm
.	O
</s>
<s>
Serpent	B-Algorithm
took	O
a	O
conservative	O
approach	O
to	O
security	O
,	O
opting	O
for	O
a	O
large	O
security	O
margin	O
:	O
the	O
designers	O
deemed	O
16	O
rounds	O
to	O
be	O
sufficient	O
against	O
known	O
types	O
of	O
attack	O
,	O
but	O
specified	O
32	O
rounds	O
as	O
insurance	O
against	O
future	O
discoveries	O
in	O
cryptanalysis	O
.	O
</s>
<s>
The	O
official	O
NIST	O
report	O
on	O
AES	B-Algorithm
competition	O
classified	O
Serpent	B-Algorithm
as	O
having	O
a	O
high	O
security	O
margin	O
along	O
with	O
MARS	B-Algorithm
and	O
Twofish	B-Algorithm
,	O
in	O
contrast	O
to	O
the	O
adequate	O
security	O
margin	O
of	O
RC6	O
and	O
Rijndael	B-Algorithm
(	O
currently	O
AES	B-Algorithm
)	O
.	O
</s>
<s>
In	O
final	O
voting	O
,	O
Serpent	B-Algorithm
had	O
the	O
fewest	O
negative	O
votes	O
among	O
the	O
finalists	O
,	O
but	O
scored	O
second	O
place	O
overall	O
because	O
Rijndael	B-Algorithm
had	O
substantially	O
more	O
positive	O
votes	O
,	O
the	O
deciding	O
factor	O
being	O
that	O
Rijndael	B-Algorithm
allowed	O
for	O
a	O
far	O
more	O
efficient	O
software	O
implementation	O
.	O
</s>
<s>
The	O
Serpent	B-Algorithm
cipher	B-Application
algorithm	O
is	O
in	O
the	O
public	O
domain	O
and	O
has	O
not	O
been	O
patented	O
.	O
</s>
<s>
The	O
reference	O
code	O
is	O
public	B-Application
domain	I-Application
software	I-Application
and	O
the	O
optimized	O
code	O
is	O
under	O
GPL	B-License
.	O
</s>
<s>
As	O
a	O
result	O
,	O
anyone	O
is	O
free	O
to	O
incorporate	O
Serpent	B-Algorithm
in	O
their	O
software	O
(	O
or	O
hardware	O
implementations	O
)	O
without	O
paying	O
license	O
fees	O
.	O
</s>
<s>
The	O
Serpent	B-Algorithm
key	O
schedule	O
consists	O
of	O
3	O
main	O
stages	O
.	O
</s>
<s>
At	O
the	O
end	O
the	O
round	O
key	O
or	O
"	O
subkey	O
"	O
are	O
placed	O
in	O
the	O
"	O
initial	O
permutation	B-Algorithm
IP	O
"	O
to	O
place	O
the	O
key	O
bits	O
in	O
the	O
correct	O
column	O
.	O
</s>
<s>
The	O
Serpent	B-Algorithm
s-boxes	B-Algorithm
are	O
4-bit	O
permutations	B-Algorithm
,	O
and	O
subject	O
to	O
the	O
following	O
properties	O
:	O
</s>
<s>
The	O
Serpent	B-Algorithm
s-boxes	B-Algorithm
have	O
been	O
constructed	O
based	O
on	O
the	O
32	O
rows	O
of	O
the	O
DES	B-Algorithm
s-boxes	B-Algorithm
.	O
</s>
<s>
These	O
were	O
transformed	O
by	O
swapping	O
entries	O
,	O
resulting	O
arrays	O
with	O
desired	O
properties	O
were	O
stored	O
as	O
the	O
Serpent	B-Algorithm
s-boxes	B-Algorithm
.	O
</s>
<s>
This	O
process	O
was	O
repeated	O
until	O
a	O
total	O
of	O
8	O
s-boxes	B-Algorithm
were	O
found	O
.	O
</s>
<s>
The	O
initial	O
permutation	B-Algorithm
works	O
on	O
128	O
bits	O
at	O
a	O
time	O
moving	O
bits	O
around	O
.	O
</s>
<s>
The	O
final	O
permutation	B-Algorithm
works	O
on	O
128	O
bits	O
at	O
a	O
time	O
moving	O
bits	O
around	O
.	O
</s>
<s>
Consists	O
of	O
XOR	O
,	O
S-Box	B-Algorithm
,	O
bit	O
shift	O
left	O
and	O
bit	O
rotate	O
left	O
operations	O
.	O
</s>
<s>
Rijndael	B-Algorithm
is	O
a	O
substitution-linear	O
transformation	O
network	O
with	O
ten	O
,	O
twelve	O
,	O
or	O
fourteen	O
rounds	O
,	O
depending	O
on	O
the	O
key	O
size	O
,	O
and	O
with	O
key	O
sizes	O
of	O
128	O
bits	O
,	O
192	O
bits	O
,	O
or	O
256	O
bits	O
,	O
independently	O
specified	O
.	O
</s>
<s>
Serpent	B-Algorithm
is	O
a	O
substitution	B-Algorithm
–	I-Algorithm
permutation	I-Algorithm
network	I-Algorithm
which	O
has	O
thirty-two	O
rounds	O
,	O
plus	O
an	O
initial	O
and	O
a	O
final	O
permutation	B-Algorithm
to	O
simplify	O
an	O
optimized	O
implementation	O
.	O
</s>
<s>
The	O
round	O
function	O
in	O
Rijndael	B-Algorithm
consists	O
of	O
three	O
parts	O
:	O
a	O
nonlinear	O
layer	O
,	O
a	O
linear	O
mixing	O
layer	O
,	O
and	O
a	O
key-mixing	O
XOR	O
layer	O
.	O
</s>
<s>
The	O
round	O
function	O
in	O
Serpent	B-Algorithm
consists	O
of	O
key-mixing	O
XOR	O
,	O
thirty-two	O
parallel	B-Operating_System
applications	O
of	O
the	O
same	O
4×4	O
S-box	B-Algorithm
,	O
and	O
a	O
linear	O
transformation	O
,	O
except	O
in	O
the	O
last	O
round	O
,	O
wherein	O
another	O
key-mixing	O
XOR	O
replaces	O
the	O
linear	O
transformation	O
.	O
</s>
<s>
The	O
nonlinear	O
layer	O
in	O
Rijndael	B-Algorithm
uses	O
an	O
8×8	O
S-box	B-Algorithm
whereas	O
Serpent	B-Algorithm
uses	O
eight	O
different	O
4×4	O
S-boxes	B-Algorithm
.	O
</s>
<s>
The	O
32	O
rounds	O
mean	O
that	O
Serpent	B-Algorithm
has	O
a	O
higher	O
security	O
margin	O
than	O
Rijndael	B-Algorithm
;	O
however	O
,	O
Rijndael	B-Algorithm
with	O
10	O
rounds	O
is	O
faster	O
and	O
easier	O
to	O
implement	O
for	O
small	O
blocks	O
.	O
</s>
<s>
Hence	O
,	O
Rijndael	B-Algorithm
was	O
selected	O
as	O
the	O
winner	O
in	O
the	O
AES	B-Algorithm
competition	O
.	O
</s>
<s>
The	O
original	O
Serpent	B-Algorithm
,	O
Serpent-0	O
,	O
was	O
presented	O
at	O
the	O
5th	O
workshop	O
on	O
Fast	O
Software	O
Encryption	O
,	O
but	O
a	O
somewhat	O
tweaked	O
version	O
,	O
Serpent-1	O
,	O
was	O
submitted	O
to	O
the	O
AES	B-Algorithm
competition	O
.	O
</s>
<s>
The	O
AES	B-Algorithm
submission	O
paper	O
discusses	O
the	O
changes	O
,	O
which	O
include	O
key-scheduling	O
differences	O
.	O
</s>
<s>
The	O
XSL	O
attack	O
,	O
if	O
effective	O
,	O
would	O
weaken	O
Serpent	B-Algorithm
(	O
though	O
not	O
as	O
much	O
as	O
it	O
would	O
weaken	O
Rijndael	B-Algorithm
,	O
which	O
became	O
AES	B-Algorithm
)	O
.	O
</s>
<s>
presents	O
a	O
meet-in-the-middle	O
attack	O
against	O
6	O
of	O
32	O
rounds	O
of	O
Serpent	B-Algorithm
and	O
an	O
amplified	O
boomerang	O
attack	O
against	O
9	O
of	O
32	O
rounds	O
in	O
Serpent	B-Algorithm
.	O
</s>
<s>
A	O
2001	O
attack	O
by	O
Eli	O
Biham	O
,	O
Orr	O
Dunkelman	O
and	O
Nathan	O
Keller	O
presents	O
a	O
linear	O
cryptanalysis	O
attack	O
that	O
breaks	O
10	O
of	O
32	O
rounds	O
of	O
Serpent-128	O
with	O
2118	O
known	O
plaintexts	O
and	O
289	O
time	O
,	O
and	O
11	O
rounds	O
of	O
Serpent-192/256	O
with	O
2118	O
known	O
plaintexts	O
and	O
2187	O
time	O
.	O
</s>
<s>
A	O
2009	O
paper	O
has	O
noticed	O
that	O
the	O
nonlinear	O
order	O
of	O
Serpent	B-Algorithm
S-boxes	B-Algorithm
were	O
not	O
3	O
as	O
was	O
claimed	O
by	O
the	O
designers	O
.	O
</s>
<s>
A	O
2011	O
attack	O
by	O
Hongjun	O
Wu	O
,	O
Huaxiong	O
Wang	O
and	O
Phuong	O
Ha	O
Nguyen	O
,	O
also	O
using	O
linear	O
cryptanalysis	O
,	O
breaks	O
11	O
rounds	O
of	O
Serpent-128	O
with	O
2116	O
known	O
plaintexts	O
,	O
2107.5	O
time	O
and	O
2104	O
memory	O
.	O
</s>
<s>
The	O
same	O
paper	O
also	O
describes	O
two	O
attacks	O
which	O
break	O
12	O
rounds	O
of	O
Serpent-256	O
.	O
</s>
