The Euclidean Algorithm, Finding Multiplicative Inverses Modulo n-Computer Security-Lecture Handouts, Lecture notes of Computer Security

Rocky Hiranandani gave this handout to help with Computer Security course at Baddi University of Emerging Sciences and Technologies. It includes: Finding, Multiplicative, Inverse, Modulo, Euclid, Cryptosystems, Greatest, Common, Divisor

Typology: Lecture notes

2011/2012

Uploaded on 07/07/2012

indian
indian ๐Ÿ‡ฎ๐Ÿ‡ณ

3.9

(7)

134 documents

1 / 9

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Fall 2006
Chris Christensen
MAT/CSC 483
Finding Multiplicative Inverses Modulo n
Two unequal numbers being set out, and the less being continually subtracted in turn
from the greater, if the number which is left never measures the one before it until an unit
is left, the original numbers will be prime to one another. Euclid, The Elements, Book
VII, Proposition 1.
It is not necessary to do trial and error to determine the multiplicative
inverse of an integer modulo n. If the modulus being used is small (like 26)
there are only a few possibilities to check (26); trial and error might be a
good choice. However, some modern public key cryptosystems use very
large moduli and require the determination of inverses.
We will now examine a method that can be used to construct multiplicative
inverses modulo n (when they exist).
Euclidean, of course, refers to the Greek mathematician Euclid (c. 325 - 265
BC).
Euclid's Elements, in addition to geometry, contains a great deal of number
theory โ€“ properties of the positive integers (whole numbers). The Euclidean
algorithm is Proposition II of Book VII of Euclidโ€™s Elements. Euclid's
question was this: given two lengths (which are positive integers) what is the
largest (integer) length that can be used to measure both of them? For
example, if the two given lengths are 14 and 21, the largest length that
measure both of them is 7; 14 is 27
ร—
and 21 is 37
ร—
. If the two lengths are
24 and 40, the greatest common measure is 8. If the two lengths are 7 and
25, the greatest common measure is 1. Etc.
Euclid describes a process for determining the greatest common measure of
two lengths. In terms of number theory, he is describing how to find what is
now called the greatest common divisor (gcd) of two positive integers.
1
docsity.com
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download The Euclidean Algorithm, Finding Multiplicative Inverses Modulo n-Computer Security-Lecture Handouts and more Lecture notes Computer Security in PDF only on Docsity!

Fall 2006 Chris Christensen MAT/CSC 483

Finding Multiplicative Inverses Modulo n

Two unequal numbers being set out, and the less being continually subtracted in turn from the greater, if the number which is left never measures the one before it until an unit is left, the original numbers will be prime to one another. Euclid , The Elements, Book VII, Proposition 1_._

It is not necessary to do trial and error to determine the multiplicative inverse of an integer modulo n. If the modulus being used is small (like 26) there are only a few possibilities to check (26); trial and error might be a good choice. However, some modern public key cryptosystems use very large moduli and require the determination of inverses.

We will now examine a method that can be used to construct multiplicative inverses modulo n (when they exist).

Euclidean, of course, refers to the Greek mathematician Euclid (c. 325 - 265 BC).

Euclid's Elements , in addition to geometry, contains a great deal of number theory โ€“ properties of the positive integers (whole numbers). The Euclidean algorithm is Proposition II of Book VII of Euclidโ€™s Elements. Euclid's question was this: given two lengths (which are positive integers) what is the largest (integer) length that can be used to measure both of them? For example, if the two given lengths are 14 and 21, the largest length that measure both of them is 7; 14 is 2 ร— 7 and 21 is 3 ร— 7. If the two lengths are 24 and 40, the greatest common measure is 8. If the two lengths are 7 and 25, the greatest common measure is 1. Etc.

Euclid describes a process for determining the greatest common measure of two lengths. In terms of number theory, he is describing how to find what is now called the greatest common divisor (gcd) of two positive integers.

1

The Euclidean Algorithm to Find the Greatest Common Divisor

Let us begin with the two positive integers, say, 13566 and 35742.

Divide the smaller into the larger:

35742 = 2 ร— 13566 + 8610

Divide the remainder (8610) into the previous divisor (35742):

13566 = 1 ร— 8610 + 4956

Continue to divide remainders into previous divisors:

8610 = 1 ร— 4956 + 3654

4956 = 1 ร— 3654 + 1302

3654 = 1 ร— 1302 + 1050

1302 = 1 ร— 1050 + 252

1050 = 4 ร— 252 + 42

252 = 6 ร— 42

The process stops when the remainder is 0.

The greatest common divisor of 13566 and 35742 is 42.

gcd(13566, 35742)=42.

2

Now, we must see that it is the greatest common divisor. We do this by showing that 42 can be written in terms of 13566 and 35742 as follows:

Begin near the bottom of the divisions. Because 1050 = 4 ร— 252 + 42 ,

42 = 1 ร— 1050 โˆ’ 4 ร— 252

Because 1 302 = 1 ร— 1050 + 252 , 2 52 = 1 ร— 1320 โˆ’ 1 ร— 1050. Substitute this for 252 in the expression above for 42.

42 1 1050 4 252 42 1 1050 4 (1 1302 1 1050) 42 5 1050 4 1302

= ร— โˆ’ ร—

= ร— โˆ’ ร— ร— โˆ’ ร—

= ร— โˆ’ ร—

Because 3 654 = 2 ร— 1302 + 1050 , 1 050 = 1 ร— 3654 โˆ’ 2 ร— 1302. So,

42 5 1050 4 1302 42 5 (1 3654 2 1302) 4 1302 42 5 3654 14 1302

= ร— โˆ’ ร—

= ร— ร— โˆ’ ร— โˆ’ ร—

= ร— โˆ’ ร—

Because 4956 = 1 ร— 3654 + 1302 , 1 302 = 1 ร— 4956 โˆ’ 1 ร— 3654. So,

42 5 3654 14 1302 42 5 3654 14 (1 4956 1 3654) 42 19 3654 14 4956

= ร— โˆ’ ร—

= ร— โˆ’ ร— ร— โˆ’ ร—

= ร— โˆ’ ร—

Because 8 610 = 1 ร— 4956 + 3654 , 3 654 = 1 ร— 8610 โˆ’ 1 ร— 4956. So,

42 19 3654 14 4956 42 19 (1 8610 1 4956) 14 4956 42 19 8610 33 4956

= ร— โˆ’ ร—

= ร— ร— โˆ’ ร— โˆ’ ร—

= ร— โˆ’ ร—

4

Because 1 3566 = 1 ร— 8610 + 4956 , 4 956 = 1 ร— 13566 โˆ’ 1 ร— 8610. So,

42 19 8610 33 4956 42 19 8610 33 (1 13566 1 8610) 42 52 8610 33 13566

= ร— โˆ’ ร—

= ร— โˆ’ ร— ร— โˆ’ ร—

= ร— โˆ’ ร—

Because 3 5742 = 2 ร— 13566 + 8610 , 8 610 = 1 ร— 35742 โˆ’ 2 ร— 13566. So,

42 52 8610 33 13566 42 52 (1 35742 2 13566) 33 13566 42 52 35742 137 13566

= ร— โˆ’ ร—

= ร— ร— โˆ’ ร— โˆ’ ร—

= ร— โˆ’ ร—

What is important here is that the gcd of 35742 and 13566 can be expressed as a combination of them by reversing the division portion of the Euclidean algorithm. So, any common divisor of 35742 and 13566 must divide the right-hand side of and, therefore, must divide

  1. This implies that 42 is the greatest common divisor.

42 = 52 ร— 35742 โˆ’ 137 ร— 13566

Relatively Prime

A pair of positive integers is said to be relatively prime if their greatest common divisor is 1. 3 and 5 are relatively prime because gcd(3, 5) = 1. 4 and 15 are relatively prime because gcd(4, 15) = 1. But, 6 and 33 are not relatively prime because gcd(6, 33) = 3.

5

1 = 7 ร— 15 โˆ’ 4 ร— 26

So, 1 = 7 ร— 15 โˆ’ 4 ร— 26.

Finally, "go mod 26." Because 26 = 0mod 26, when we "go mod 26," the equation 1 = 7 ร— 15 โˆ’ 4 ร— 26 becomes the congruence1= 7 ร— 15mod 26. So, the inverse of 15 modulo 26 is 7 (and the inverse of 7 modulo 26 is 15).

gcd(6, 26) = 2; 6 and 26 are not relatively prime. Therefore, 6 does not have a multiplicative inverse modulo 26. For, assume that it did; say, m is the multiplicative inverse of 6 modulo 26. Then we would have that

. This means that 6 m is equal to 1 plus a multiple of 26: 6 m = 1 + 26 k. But, 2 divides 6 and 2 divides 26; therefore, if the equation is correct, 2 divides 1. Of course, this is false; therefore, the assumption that 6 has a multiplicative inverse modulo 26 must be false. A similar argument would work for any integer that is not relatively prime to 26.

6 m = 1mod 2 6

1, 3, 5, 7, 9, 11, 15, 17, 19, 21, 23, 25 are relatively prime to 26 and, therefore, have inverses modulo 26. 2, 4, 6, 8, 10, 12, 13, 14, 16, 18, 20, 22, 24 are not relatively prime to 26 and, therefore, do not have inverses modulo

7

Exercises

  1. Determine each of the following greatest common divisors. You need not use the Euclidean algorithm to find the gcds. Which of the pairs are relatively prime?

2a. gcd(6, 15) 2b. gcd(6, 16). 2c. gcd(8, 17). 2d. gcd(6, 21). 2e. gcd(15, 27).

  1. Determine each of the following greatest common divisors. Which of the pairs are relatively prime?

3a. gcd(37, 3120). 3b. gcd(24, 138). 3c. gcd(12378, 3054). 3d. gcd(314, 159). 3e. gcd(306, 657).

  1. For each of the gcds in exercise 2, write the gcd as a combination of the two given integers.
  2. Find the multiplicative inverse of 37 modulo 3120.
  3. Find the multiplicative inverse of 19 modulo 26.
  4. Does 24 have a multiplicative inverse modulo 138 Explain.
  5. What integers modulo 16 have multiplicative inverses? Determine the inverses.

8