Code and ciphers: Julius Caesar, the Enigma and the internet
Code and ciphers: Julius Caesar, the Enigma and the internet
Code and ciphers: Julius Caesar, the Enigma and the internet
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
combining <strong>the</strong> keys of two or more linear recurrences, as <strong>the</strong> following<br />
simple example shows.<br />
Example 8.2<br />
Use <strong>the</strong> (mod 2) sum of <strong>the</strong> keys generated by <strong>the</strong> two linear recurrences<br />
<strong>and</strong><br />
U n �U (n�1) �U (n�2) , U 0 �U 1 �1<br />
U n �U (n�1) �U (n�3) , U 0 �U 1 �U 2 �1<br />
to produce a new key. Verify that this has a period of 21.<br />
Verification<br />
The first recurrence, as we have seen, has a period of length 3 <strong>and</strong> produces<br />
<strong>the</strong> keystream<br />
110110110110...<br />
The second recurrence has a period of length 7 <strong>and</strong> produces <strong>the</strong> key<br />
stream<br />
111010011101001110100....<br />
Producing r<strong>and</strong>om numbers <strong>and</strong> letters 105<br />
Writing both of <strong>the</strong>se out one under <strong>the</strong> o<strong>the</strong>r <strong>and</strong> adding <strong>the</strong> bits (mod 2)<br />
we have<br />
1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 0.... .<br />
1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 0 1 0.... .<br />
Adding (mod 2) 0 0 1 1 0 0 1 0 1 0 1 1 1 1 1 0 0 0 0 1 0 0 0 1 1 0 0....<br />
.<br />
<strong>and</strong> we see that <strong>the</strong> key repeats after 21 places, but not before. Since <strong>the</strong><br />
first key has period 3 <strong>and</strong> <strong>the</strong> second key has period 7 <strong>the</strong> period of <strong>the</strong><br />
combined key cannot exceed 21, for both keys repeat after 21 places. On<br />
<strong>the</strong> o<strong>the</strong>r h<strong>and</strong>, since 3 <strong>and</strong> 7 have no common factor, <strong>the</strong> combined key<br />
cannot repeat after less than 21 places.<br />
There is no need to restrict ourselves to <strong>the</strong> use of two linear recurrences;<br />
we could use three or more. The advantage would be that <strong>the</strong> more we use<br />
<strong>the</strong> more difficult it would be for a cryptanalyst to solve <strong>the</strong> system. The<br />
disadvantage, if we are working by h<strong>and</strong>, would be <strong>the</strong> tedious nature of<br />
<strong>the</strong> key generation <strong>and</strong> <strong>the</strong> increased probability of errors. Of course if we<br />
have a means of generating <strong>the</strong> key by ei<strong>the</strong>r a mechanical or an electronic<br />
device <strong>the</strong> disadvantage disappears. It is not, <strong>the</strong>refore, surprising that