30.11.2012 Views

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

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Having converted <strong>the</strong> characters of text to eight-bit bytes <strong>the</strong>y would<br />

<strong>the</strong>n normally be added ‘linearly’ (mod 2), that is bit by bit without ‘carrying’,<br />

to <strong>the</strong> binary key to produce <strong>the</strong> cipher. So, for example, if <strong>the</strong><br />

message letter is E <strong>and</strong> <strong>the</strong> corresponding key letter is $,<br />

E�01000101,<br />

$�00100100.<br />

Adding (mod 2)<br />

01100001�97�a,<br />

i.e. <strong>the</strong> cipher letter is a.<br />

There are alternatives to this ‘linear’ or bit-by-bit addition; a very<br />

important <strong>and</strong> secure system, <strong>the</strong> Data Encryption St<strong>and</strong>ard (DES)<br />

described in Chapter 13, treats some of <strong>the</strong> bits in a ‘non-linear’ way.<br />

Binary linear sequences as key generators<br />

When we generate a binary sequence by using a linear recurrence of order<br />

k we produce a sequence of 0s <strong>and</strong> 1s. Could this sequence go on indefinitely<br />

without repeating? The answer is ‘No’ because each new term<br />

depends only on <strong>the</strong> values of <strong>the</strong> previous k terms <strong>and</strong> since each of <strong>the</strong>se<br />

is 0 or 1 <strong>the</strong>re are only 2 k different possibilities for <strong>the</strong>m. It follows that<br />

after 2 k terms, at most, some set of k consecutive binary terms must recur.<br />

Thus <strong>the</strong> Fibonacci sequence (mod 2) is<br />

0, 1, 1, 0, 1, 1, 0, 1, 1, 0, ...<br />

Producing r<strong>and</strong>om numbers <strong>and</strong> letters 101<br />

<strong>and</strong> we see that <strong>the</strong> binary sequence consists simply of <strong>the</strong> triplet 011<br />

repeated indefinitely. Since <strong>the</strong> Fibonacci sequence is generated by a<br />

linear recurrence of order 2 we have k�2 in this case, <strong>and</strong> so we know that<br />

in binary form <strong>the</strong> sequence must repeat after at most 2 2 �4 terms. In fact it<br />

repeats after 3 <strong>and</strong> this is, in reality, <strong>the</strong> maximum that it can be, because<br />

one of <strong>the</strong> 4 possible pairs of consecutive binary terms is 00 <strong>and</strong> such a<br />

pair will generate 0s for ever. Conversely, no o<strong>the</strong>r binary sequence can<br />

contain 00 <strong>and</strong> so <strong>the</strong> maximum possible number of binary terms that we<br />

can have before <strong>the</strong> sequence starts to repeat is 3, not 4. For <strong>the</strong> same<br />

reason <strong>the</strong> maximum number of terms before a binary linear recurrence<br />

of order k begins to repeat is 2 k �1, not 2 k . The binary Fibonacci sequence,<br />

modest though it is, <strong>the</strong>refore has maximum period.<br />

Obviously no binary sequence with a maximum period of 3 is of interest<br />

to cryptographers but what about binary sequences of higher order?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!