E Xam Ple. Let: 2.11 Lineal' Feed Back Shift R Egister Sequences
E Xam Ple. Let: 2.11 Lineal' Feed Back Shift R Egister Sequences
L FS n S e q u e n c e s 43
n = 9788470140853110794168855217413715781961.
Take x = 873245647888478349013. The initial seed is
x0 = x2 (mod n)
= 8845298710478780097089917746010122863172.
H = 7118894281131329522745962455498123822408
z2 = 3145174608888893164151380152060704518227
i3 = 4898007782307156233272233185574899430355
xA 5 3935457818935112922347093546189672310389
x5 = 675099511510097048901761303198740246040
a:6 = 4289914828771740133546190658266515171326
xT = 4431066711454378260890386385593817521668
xa = 7336876124195046397414235333675005372436.
Taking the least significant bit of each of these, which is easily done
by checking whether the number is odd or even, produces the sequence
,68 = 0, 1, 1, 1, 0, 0, 0, 0. ■
The sequence
01000010010110011111000110111010100001001011001111
Xi = 0, $2 = 1, X3 = 0,11 = 0, 15 — 0
where the coefficients Cq, cl, . . . are integers. If we specify the in itia l v alu es
£2>. • ., x m,
(plaintext) 1011001110001111
(key) + 0100001001011001
(ciphertext) 1111000111010110
$ n +31 = X n + X „+ 3
and any nonzero initial vector will produce a sequence th a t has period 231 —
1 = 2147483647. Therefore, 62 bits produce more than two billion bits of
2 .1 1 . L F S R S e q u e n c e s 45
P la in te x t
key. This is a great advantage over a one-time pad, where the full two billion
bits m ust be sent in advance.
This method can be implemented very easily in hardware using w hat is
known as a lin e a r fe e d b a c k s h ift re g is te r (LFSR) and is very fast. In
Figure 2.1 we depict an example of a linear feedback shift register in a simple
case. More com plicated recurrences are implemented using more registers
and more XORs,
For each increment of a counter, the bit in each box is shifted to other
boxes as indicated, with © denoting the addition mod 2 of the incoming
bits. T he output, which is the bit x m , is added to the next bit of plaintext to
produce the ciphertext. T he diagram in Figure 2.1 represents the recurrence
i m+3 = x m+i + x m. Once the initial values x \, in , $3 are specified, the
machine produces the subsequent bits very efficiently.
U nfortunately, the preceding encryption method succumbs easily to a
known plaintext attack. More precisely, if we know only a few consecutive
bits of plaintext, along with the corresponding bits of ciphertext, we can
determine the recurrence relation and therefore com pute all subsequent bits
of the key. By subtracting (or adding; it’s all the same mod 2) the plaintext
from the ciphertext mod 2, we obtain the bits of th e key. Therefore, for
the rest of this discussion, we will ignore the ciphertext and plaintext and
assume we have discovered a portion of the key sequence. Our goal is to
use this portion of the key to deduce the coefficients of the recurrence and
consequently com pute the rest of the key.
For example, suppose we know the initial segment 011010111100 of the
sequence 0110101111000100110101 111. . . , which has period 15, and suppose
we know it is generated by a linear recurrence. How do we determine the
coefficients of the recurrence? We do not necessarily know even the length,
so we s ta rt with length 2 (length 1 would produce a constant sequence).
Suppose the recurrence is i n+2 = co$n + Ci2n+1. Let tl = 1 and tl = 2
and use the known values x i = 0, 2:2 = 1, X3 = 1,$4 = 0. We obtain the
<16 C h a p t e u 2. C l a s s ic a l C r y p t o s y s t e m s
e q u a tio n s
1 = c0 ■0 + ci • 1 (n = 1)
0 = co ■1 + Ci ■ 1 (n = 2).
The determ inant of the m atrix is 0 mod 2; in fact, the equation has no
solution. We can see this because every column in the m atrix sums to 0
mod 2 , while the vector on the right does not.
Now consider length 4. The m atrix equation is
1 , 0 , 1 , 0 , 0 , 1, 0 , 1, 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 .
A reasonable guess is that m = 8 gives the last nonzero determ inant. When
we solve the m atrix equation for the coefficients we get
{C0 ,C ,,...,C 7} = { 1 , 1, 0 , 0 , 1, 0 , 0 , 0 },
-^ r i f'fi — T-n 4 .1 -
This recurrence generates all 100 term s of the original sequence, so we have
the correct answer, at least based on the knowledge th a t we have.
Suppose th a t the 100 bits were in the middle of some sequence, and we
want to know the preceding bits. For example, suppose the sequence starts
w ith i n , so i n = 1, x xg = 0, Xig = 0 ,___W rite the recurrence as
(it might appear th a t we made some sign errors, but recall th a t we are
working mod 2, so —xn = x n and —x n+8 = x„+e). Letting n = IC yields
X lfi = X n + X 20 + X 2.|
= 1 + 0 + 1 = 0.
Let N be the length oj the shortest recurrence that generates the sequence
z i , X 2,X3 , ___ Then d e t( M/ t ) = 1 (mod 2) and d et( Mn) = 0 (mod 2) fo r
all n > N.
Since 6 is not the zero vector, bj j ^O for at least one j . Let m be the largest
j such that bj / 0, which means that bm = 1. We are working mod 2, so
bmxn+m- i — —Xn+m-i. Therefore, we can rearrange the relation to obtain
2.12 Enigma
Mechanical encryption devices known as rotor machines were developed in
the 1920s by several people. The best known was designed by A rthur Scher-
bius and became the famous Enigma machine used by the Germans in World
War II.
It was believed to be very secure and several attem pts at breaking the
system ended in failure. However, a group of three Polish cryptologists,
Marian Rejewski, Henryk Zygalski, and Jerzy Rdzycki, succeeded in break
ing early versions of Enigma during the 1930s. Their techniques were passed
to the British in 1939, two m onths before Germany invaded Poland. The
British extended the Polish techniques and successfully decrypted German
messages throughout World War II.
The fact that Enigma had been broken remained a secret for almost 30
years after the end of the war, partly because the British had sold captured
Enigma machines to former colonies and didn't want them to know th a t the
system had been broken.
In the following, we give a brief description of Enigma and then describe
an attack developed by Rejewski. For more details, see for example [Koza-
czuk]. This book contains appendices by Rejeweski giving details of attacks
on Enigma.
We give a basic schematic diagram of the machine in Figure 2.2. For
more details, we urge the reader to visit some of the many websites th at can