06.01.2015 Views

Cryptology - Unofficial St. Mary's College of California Web Site

Cryptology - Unofficial St. Mary's College of California Web Site

Cryptology - Unofficial St. Mary's College of California Web Site

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

60 CHAPTER 4. THE EUCLIDEAN ALGORITHM<br />

<strong>of</strong> the Euclidean Algorithm will do this for us.<br />

For example, suppose we had used k = 9 as our multiplicative key (modulo<br />

26). To decipher we need to use the key c satisfying (9c)%26 = 1, or, equivalently,<br />

9 × c ≡ 1 (mod 26). To find c we extend Euclid’s Algorithm by adding a<br />

new line, a “coefficient line,” that begins with a 0 and a 1 and is continued by<br />

the formula<br />

old c − current q × current c = new c.<br />

Examples:<br />

(1) Find gcd(9, 26) and the inverse <strong>of</strong> 9 modulo 26.<br />

For this example we will first work one step at a time.<br />

Begin with gcd entries and 0 and 1:<br />

From 26 ÷ 9,<br />

From 9 ÷ 8,<br />

From 8 ÷ 1,<br />

{<br />

q = 2, r = 8, and<br />

0 − (2 × 1) = −2 :<br />

{<br />

q = 1, r = 1, and<br />

1 − (1 × −2) = 3 :<br />

{<br />

q = 8, r = 0, and<br />

2 − (8 × 3) = −26 :<br />

q<br />

r<br />

c<br />

q<br />

r<br />

c<br />

q<br />

r<br />

c<br />

q<br />

r<br />

c<br />

26<br />

0<br />

26<br />

0<br />

26<br />

0<br />

26<br />

0<br />

2<br />

9<br />

1<br />

2<br />

9<br />

1<br />

2<br />

9<br />

1<br />

9<br />

1<br />

8<br />

-2<br />

1<br />

8<br />

−2<br />

1<br />

8<br />

−2<br />

1<br />

3<br />

8<br />

1<br />

3<br />

0<br />

-26<br />

Just as the final (non-zero) entry in the remainder line is the gcd, the entry<br />

in the coefficient line under the gcd gives us the solution to 9 × x ≡ gcd<br />

(mod 26). So 9 × 3 ≡ 1 (mod 26). (The −26 at the end <strong>of</strong> the coefficient<br />

line is ignored.)

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

Saved successfully!

Ooh no, something went wrong!