Docsity

Lagrange’s Theorem, Fermatts Litte Theorem-Computer Security-Lecture Slides, Slides of Computer Security

Partial preview of the text

Download Lagrange’s Theorem, Fermatts Litte Theorem-Computer Security-Lecture Slides and more Slides Computer Security in PDF only on Docsity!

Computer Security

Today’s Lecture

• Lagrange’s Theorem

• Fermatts Litte Theorem

Fermats Little Theorem

Suppose p is a prime and a ∈ ZP then

ap^ = a (mod p) Or ap-1=1 mod p

*We are skipping finite fields for now

Few basics algorithms

• Euclid’s gcd algorithm

• The Chinese Remainder Theorem,

• Computing Jacobi and Legendre symbols.

Euclid’s gcd algorithm (1)

gcd(a, b) → gcd(a (mod b), b)

Example:

• Using the Euclidean algorithm we compute gcd(21, 12) in the

steps gcd(21, 12) = gcd(21 (mod 12), 12) = gcd(9, 12) = gcd(12 (mod 9), 9) = gcd(3, 9) = gcd(9 (mod 3), 3) = gcd(0, 3) = 3.

Euclid’s gcd algorithm (2)

• Theorem

 gcd( a , b )=gcd( b , a mod b )

• Euclidean Algorithm

 Eculidean(a,b)

  1. Aa; Bb
  2. If B = 0 return A = gcd(a,b)
  3. R = A mod B
  4. A  B
  5. B  R
  6. Go to 2

• Example

• gcd(55,22)

• gcd(22,55mod22)

• gcd(22,11)

• gcd(11,22mod11)

• gcd(11,0)

• gcd=

  • Eculidean algorithm can be used to find gcd, and can be used to check whether two numbers are relatively prime

Extended Euclidean algorithm (2)

  • Iterative Method
  • This method computes expressions of the form ri = axi + byi for the remainder in each step i
  • Each successive number ri can be written as the remainder of the division of the previous two such numbers
  • By substitution, this gives:
  • Starting coefficients are x 1 = 1, y 1 = 0, x 2 = 0, and y 2 = 1 and others are given by

Extended Euclidean algorithm (3)

  • The last line reads 1 = 120 × −9 + 23 × 47, which is the required solution: x = −9 and y = 47.
  • 47 × 23 ≡ 1 ( mod 120) and also −9 × 120 ≡14 × 5 ≡ 1 ( mod 23).