Transcript Slide 1

Modula Arithmetic
Rachana Y. Patil
1
Cryptographic Theory
• Primality:
• Two nos are relatively prime if they have no
factors common in them other than 1.
i.e gcd(a,n) = 1
gcd (7, 78) = 1
Euclid’s Alorithm
• What is gcd of 21 and 45???
gcd(a,b) = gcd(b, a mod b)
Modular Arithmetic
• Says that 23 and 11 are equivalent ??????
• 23 mod 11 = 12
• Or 23≡ 11 mod 12 …..
Cont…
• a ≡ b mod n if a = b + kn for some integer k.
• If a > 0 and 0 < b < n then b is the remainder of
the division a/n.
Properties of Modulo operator
• a ≡ b mod n if n/a-b
• a ≡ b mod n ═> b ≡ a mod n
• a ≡ b mod n and b ≡ c mod n implies
a ≡ c mod n
Modular Arithmetic
• (a mod n) + (b mod n) = ( a + b ) mod n
• (a mod n) x (b mod n) = (a x b) mod n
• (a + b) ≡ (a + c) mod n then b ≡ c mod n
Euler’s theorem
• Euler’s Toient function Ø(n)
• Ø(n) is the set of +ve integers less than n and relatively
prime to n
• n = 6 What is Ø(n) ????
• n=7
•
Ø(n) = ????
Euler’s theorem….cont
•
•
•
•
•
•
For any prime no Ø(n) = n-1.
Suppose p and q are two prime nos.
For n=pq we have
Ø(n) = Ø(pq) = Ø(p) x Ø(q) = (p-1) x (q-1)
n=21 p=3 and q = 7
Ø(21) = Ø(3) x Ø(7) = 2 x 6 = 12.
Fermat’s Theorem
• If p is prime and a is a +ve integer not divisible by p then
• a p-1 ≡ 1 (mod p)
Let a = 3 and p = 5
a 5-1 = a 4 = 34 = 81 ≡ 1 (mod 5)
proved…..
The Theorem
•
•
•
•
•
For every a and n which are relatively prime
a Ø(n) ≡ 1 (mod n)
a = 3 n = 10
Ø(n) = Ø(10) = 1,3,7,9 = 4
a Ø(n) = 3 4 = 81 ≡ 1 (mod 10)
hence proved
Modular Exponentiation
• xy mod n = xy mod ø(n) mod n
• if y = 1 mod ø(n) then xy mod n = x mod n
Modular exponentiation
• One way function used in cryptography
• ax mod n
• Can u find x where ax = b mod n???
• That is the discrete logarithm problem
• If 3x = 15 mod (17) find x…….
Discrete Logarithm problem
•
•
•
•
Solution….easy enough
Solve 3x mod 15 = 17
x=6
For large nos solving this is difficult!!!