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.

108<br />

chapter 8<br />

multiplier built into <strong>the</strong> program, <strong>and</strong> <strong>the</strong> choice of seed left to <strong>the</strong> user. To<br />

ensure even better results more than one such generator may be used <strong>and</strong><br />

<strong>the</strong>ir outputs combined in some way. Fur<strong>the</strong>r improvement can be<br />

achieved if <strong>the</strong> numbers are not used in <strong>the</strong> order in which <strong>the</strong>y are produced,<br />

but some form of ‘shuffling’ is employed to reduce <strong>the</strong> risk of correlation<br />

between consecutive numbers. In this way good, long,<br />

‘pseudo-r<strong>and</strong>om’ sequences may be generated. Among <strong>the</strong> known ‘good’<br />

choices for A, B <strong>and</strong> M are those shown in Table 8.1.<br />

Table 8.1<br />

A B M<br />

106 11 283 116 075<br />

171 11 213 153 125<br />

141 28 411 134 456<br />

421 54 773 259 200<br />

At <strong>the</strong> o<strong>the</strong>r extreme, a single generator with badly chosen values of A,<br />

B <strong>and</strong> M may produce key with a very short period. Here is a small scale<br />

example to illustrate <strong>the</strong>se situations.<br />

Example 8.4<br />

Use <strong>the</strong> recurrence<br />

U n �3U (n�1) �4 (mod 17)<br />

to generate a sequence of integers starting with (1) U 0 �5, (2) U 0 �15.<br />

Generation<br />

(1) Since U 0 �5, U 1 �3�5�4�19�2 (mod 17) etc. The 16-long sequence<br />

is<br />

5, 2, 10, 0, 4, 16, 1, 7, 8, 11, 3, 13, 9, 14, 12, 6, 5, 2, 10,<br />

... .<br />

This generator, though modest, produces <strong>the</strong> maximum possible cycle,<br />

which is 16 in this case. For additional comments see M13.<br />

(2) U 0 �15 gives U 1 �3�15�4�49�15 (mod 17), so <strong>the</strong> period is<br />

1! This explains why <strong>the</strong> value 15 doesn’t occur in <strong>the</strong> 16-long cycle<br />

above.<br />

Problem 8.2<br />

Verify that <strong>the</strong> mid-square method which uses four-digit numbers starting<br />

with X�7789 degenerates into a sequence of four numbers.

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

Saved successfully!

Ooh no, something went wrong!