Lecture-04 Euler Fermat
Lecture-04 Euler Fermat
φ(pα ) = pα − pα−1,
!
Y 1
φ(n) = n 1− .
p|n
p
3
Euler’s Theorem
4
Example. Let m = 13 × 23 = 299, where 13
and 23 are primes. Then
5
Example of the use of Euler’s theorem.
Second,
procedure power(a,n,m)
e = n;
y = 1;
z = a;
repeat {
if (e is odd) y = (y*z)%m;
if (e <= 1) return (y);
z = (z*z)%m;
e = floor(e/2);
}
end power;
8
Finding large primes
11
Around 1980, two-key or asymmetric ciphers
were invented.
14
Alice secretly chooses a random xA in
0 < xA < p − 1 and computes yA = axA mod p.
Bob secretly chooses a random xB in
0 < xB < p − 1 and computes yB = axB mod p.
x
Alice computes KA = yBA mod p.
x
Bob computes KB = yAB mod p.
Then
KA ≡ axA·xB ≡ KB (mod p)
and 0 < KA, KB < p, so KA = KB .
15
Alice and Bob choose certain agreed-upon bits
from KA to use as their key for a single-key
cipher like DES or AES.
16
Discrete Logarithms
17
The RSA public-key cipher
18
Each user of RSA has her own set of keys:
Make n and e public, but keep d secret. The
factors p and q are not needed after e and d
are computed, but in any case should not be
revealed.
19
Pohlig-Hellman cipher
21
Suppose nA < nB . Then Alice can sign (and
encipher) a message M to Bob by sending C =
EB (DA(M )) to Bob. Bob can decipher C by
applying DB to it (to get DA(M )) and then
check the signature by applying EA to the lat-
ter.
22
Discrete Logarithms
23
Neglecting powers of log p, the congruence may
be solved in O(p) time and O(1) space by rais-
ing a to successive powers modulo p and com-
paring each with b.
24
Shanks’ “giant step–baby step” algorithm is
a meet-in-the-middle method which solves the
√ √
congruence in O( p) time and O( p) space
as follows.
√
Let m = ⌈ p − 1⌉.
Finally, x = mj + i mod p − 1.
25
Example: Solve 5x ≡ 44 (mod 97).
√
We have p = 97, m = ⌈ 97 − 1 ⌉ = 10, a = 5,
b = 44. Then am ≡ 510 ≡ 53 (mod 97) and
a−1 ≡ a95 ≡ 39 (mod 97).