<s>
The	O
rail	B-Algorithm
fence	I-Algorithm
cipher	I-Algorithm
(	O
also	O
called	O
a	O
zigzag	B-Algorithm
cipher	I-Algorithm
)	O
is	O
a	O
classical	B-Algorithm
type	O
of	O
transposition	B-Algorithm
cipher	I-Algorithm
.	O
</s>
<s>
In	O
the	O
rail	B-Algorithm
fence	I-Algorithm
cipher	I-Algorithm
,	O
the	O
plaintext	O
is	O
written	O
downwards	O
diagonally	O
on	O
successive	O
"	O
rails	O
"	O
of	O
an	O
imaginary	O
fence	O
,	O
then	O
moving	O
up	O
when	O
the	O
bottom	O
rail	O
is	O
reached	O
,	O
down	O
again	O
when	O
the	O
top	O
rail	O
is	O
reached	O
,	O
and	O
so	O
on	O
until	O
the	O
whole	O
plaintext	O
is	O
written	O
out	O
.	O
</s>
<s>
We	O
will	O
add	O
two	O
variables	O
,	O
and	O
,	O
where	O
=	O
the	O
number	O
of	O
diagonals	O
in	O
the	O
decrypted	O
Rail	B-Algorithm
Fence	I-Algorithm
,	O
and	O
=	O
the	O
number	O
of	O
empty	O
spaces	O
in	O
the	O
last	O
diagonal	O
.	O
</s>
<s>
By	O
blocking	O
out	O
the	O
empty	O
spaces	O
at	O
the	O
end	O
of	O
the	O
last	O
diagonal	O
,	O
we	O
can	O
simply	O
fill	O
in	O
the	O
Rail	B-Algorithm
Fence	I-Algorithm
line	O
by	O
line	O
using	O
the	O
ciphertext	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
the	O
rail-fence	B-Algorithm
cipher	I-Algorithm
is	O
considered	O
weak	O
.	O
</s>
<s>
The	O
term	O
zigzag	B-Algorithm
cipher	I-Algorithm
may	O
refer	O
to	O
the	O
rail	B-Algorithm
fence	I-Algorithm
cipher	I-Algorithm
as	O
described	O
above	O
.	O
</s>
