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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

(4) Now (k x ) y �(k y ) x �m xy (mod p)�K (say) <strong>and</strong> K is <strong>the</strong> common key which<br />

both X <strong>and</strong> Y can use, even though nei<strong>the</strong>r of <strong>the</strong>m knows <strong>the</strong> o<strong>the</strong>r’s<br />

secret key.<br />

Before one can use <strong>the</strong> Diffie–Hellman system it is necessary to be able<br />

to find a very large prime number, <strong>and</strong> this is a non-trivial task. We meet<br />

this problem again in <strong>the</strong> RSA encryption system (where two large<br />

primes are needed), where references to an interesting approach will be<br />

found.<br />

In a realistic example <strong>the</strong> prime p would be very large but <strong>the</strong> essence<br />

of <strong>the</strong> method can be illustrated with a prime of moderate size.<br />

Example 12.1<br />

In <strong>the</strong> Diffie–Hellman system if p�59, m�3, x�7 <strong>and</strong> y�11 what will be<br />

<strong>the</strong> values of k x , k y <strong>and</strong> K?<br />

Solution<br />

(1) We first note that ( p�1)�58�2�29 <strong>and</strong> so has no factor in common<br />

with x or y.<br />

(2) X computes 3 7 (mod 59) <strong>and</strong> Y computes 3 11 (mod 59). These calculations<br />

can be done in various ways, some more efficient than o<strong>the</strong>rs (M22).<br />

In this case <strong>the</strong> numbers are sufficiently small that <strong>the</strong> powers can be<br />

h<strong>and</strong>led on a pocket calculator. Thus<br />

3 7 �2187�37�59�4,<br />

3 11 �177 147�59�3002�29<br />

so k x �4 <strong>and</strong> k y �29.<br />

(3) The value of <strong>the</strong> common key, K, is <strong>the</strong>n given ei<strong>the</strong>r by 4 11 (mod 59) or<br />

by 29 7 (mod 59). These should give <strong>the</strong> same value; if <strong>the</strong>y don’t we have<br />

made a mistake. Therefore as a check we compute <strong>the</strong>m both. The<br />

numbers this time are somewhat bigger so we compute <strong>the</strong>m by forming<br />

powers <strong>and</strong> reducing (mod 59) at each stage thus:<br />

(i) 4 5 �1024�17�59�21�21 (mod 59)<br />

so<br />

4 10 �441�7�59�28�28 (mod 59)<br />

<strong>and</strong> <strong>the</strong>refore<br />

4 11 �4�28�112�1�59�53�53 (mod 59).<br />

We conclude that <strong>the</strong> common key, K, is 53.<br />

(ii) We check this by computing 29 7 (mod 59).<br />

29 2 �841�14�59�15�15 (mod 59)<br />

Public key cryptography 167

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

Saved successfully!

Ooh no, something went wrong!