euler and fermat theorem

25
Fermat and Euler’s Fermat and Euler’s Theorems Theorems Presented By : Presented By : Ankita Pandey Ankita Pandey ME ECE- 112604 ME ECE- 112604

Upload: ankita-pandey

Post on 25-Dec-2014

2.405 views

Category:

Education


68 download

DESCRIPTION

EULER THEOREM AND FERMAT THEOREM WITH RSA EXAMPLE

TRANSCRIPT

Page 1: EULER AND FERMAT THEOREM

Fermat and Euler’s Fermat and Euler’s TheoremsTheorems

Presented By :Presented By :

Ankita PandeyAnkita Pandey

ME ECE- ME ECE- 112604112604

Page 2: EULER AND FERMAT THEOREM

CONTENTSCONTENTS

PRIME NUMBERSPRIME NUMBERS PRIME FACTORIZATIONPRIME FACTORIZATION RELATIVELY PRIME NUMBERSRELATIVELY PRIME NUMBERS GREATEST COMMON DIVISORGREATEST COMMON DIVISOR

FERMAT’S THEOREMFERMAT’S THEOREM FERMAT THEOREM PROOFFERMAT THEOREM PROOF

EULER TOTIENT FUNCTIONEULER TOTIENT FUNCTION EULER’S THEOREMEULER’S THEOREM APPLICATIONSAPPLICATIONS SUMMARYSUMMARY REFERENCESREFERENCES

Page 3: EULER AND FERMAT THEOREM

PRIME NUMBERS :PRIME NUMBERS :

Page 4: EULER AND FERMAT THEOREM

PRIME FACTORIZATION :PRIME FACTORIZATION :

Page 5: EULER AND FERMAT THEOREM

RELATIVELY PRIME NUMBERS :RELATIVELY PRIME NUMBERS :

Page 6: EULER AND FERMAT THEOREM

GREATEST COMMON DIVISOR (GCD)GREATEST COMMON DIVISOR (GCD)

Page 7: EULER AND FERMAT THEOREM

FERMAT’S THEOREMFERMAT’S THEOREM

Page 8: EULER AND FERMAT THEOREM

FERMAT’S THEOREM PROOF :FERMAT’S THEOREM PROOF :

Consider a set of positive integers less than Consider a set of positive integers less than ‘p’ : {1,2,3,…..,(p-1)} and multiply each ‘p’ : {1,2,3,…..,(p-1)} and multiply each element by ‘a’ and ‘modulo p’ , to get the set element by ‘a’ and ‘modulo p’ , to get the set

X = {a mod p, 2a mod p,…, (p-1)a mod p}X = {a mod p, 2a mod p,…, (p-1)a mod p}

No elements of X is zero and equal, since p No elements of X is zero and equal, since p doesn’t divide a.doesn’t divide a.

Multiplying the numbers in both sets (p and Multiplying the numbers in both sets (p and X) and taking the result mod p yieldsX) and taking the result mod p yields

Page 9: EULER AND FERMAT THEOREM

FERMAT’S THEOREM PROOF :FERMAT’S THEOREM PROOF :

a * 2a *…* (p-1)a [1 * 2 * 3 *…* (p-1)] a * 2a *…* (p-1)a [1 * 2 * 3 *…* (p-1)] (mod p)(mod p)

Thus on equating (p-1)! term from both the Thus on equating (p-1)! term from both the sides, since it is relatively prime to p, result sides, since it is relatively prime to p, result becomes,becomes,

An alternative form of Fermat’s Theorem is An alternative form of Fermat’s Theorem is given asgiven as

)(mod)!1()!1(1 pppa p

)(mod11 pa p

)(mod paa p

Page 10: EULER AND FERMAT THEOREM

EULER TOTIENT FUNCTION : EULER TOTIENT FUNCTION : φφ ( (nn))

((nn) : How many numbers there are ) : How many numbers there are between 1 and between 1 and nn-1 that are relatively -1 that are relatively prime to prime to nn..

(4) = 2 (1, 3 are relatively prime to 4).(4) = 2 (1, 3 are relatively prime to 4). (5) = 4 (1, 2, 3, 4 are relatively prime to (5) = 4 (1, 2, 3, 4 are relatively prime to

5).5). (6) = 2 (1, 5 are relatively prime to 6).(6) = 2 (1, 5 are relatively prime to 6). (7) = 6 (1, 2, 3, 4, 5, 6 are relatively (7) = 6 (1, 2, 3, 4, 5, 6 are relatively

prime prime to 7).to 7).

Page 11: EULER AND FERMAT THEOREM

From (5) and (7), (n) will be n-1 whenever n is a prime number.

This implies that (n) will be easy to calculate when n has exactly two different prime factors:

(P * Q) = (P-1)*(Q-1) if P and Q are prime.

EULER TOTIENT FUNCTION : EULER TOTIENT FUNCTION : φφ ( (nn))

Page 12: EULER AND FERMAT THEOREM

If GCD(a, p) = 1, and a < p, then a (p) 1(mod p).

In other words, If a and p are relatively prime, with a being the smaller integer, then when we multiply a with itself (p) times and divide the result by p, the remainder will be 1.

EULER TOTIENT FUNCTION : EULER TOTIENT FUNCTION : φφ ( (nn))

Page 13: EULER AND FERMAT THEOREM

EULER’S THEOREM :EULER’S THEOREM :

na n mod1

Page 14: EULER AND FERMAT THEOREM

EULER’S THEOREM :EULER’S THEOREM :

Above equation is true if n is prime Above equation is true if n is prime because then,because then,

and Fermat’s theorem holds.and Fermat’s theorem holds. Consider the set of such integers, Consider the set of such integers,

labeled as,labeled as,

Here each element of R is unique Here each element of R is unique positive integer less than n with GCD( positive integer less than n with GCD( ,n ) = 1. ,n ) = 1.

)1( nn

nxxxR ,...,, 21

ixix

Page 15: EULER AND FERMAT THEOREM

EULER’S THEOREM :EULER’S THEOREM :

Multiply each element by a, modulo n :Multiply each element by a, modulo n :

The set S is permutation of R :The set S is permutation of R : Because a and is relatively Because a and is relatively

prime to n, so a must also be prime to n, so a must also be relatively prime to n. Thus the relatively prime to n. Thus the elements of S are integers that elements of S are integers that are less than n and that are are less than n and that are relatively prime to n.relatively prime to n.

There are no duplicates in S. There are no duplicates in S.

naxnaxnaxS n mod,....,mod,mod 21

ixix

Page 16: EULER AND FERMAT THEOREM

EULER’S THEOREM :EULER’S THEOREM :

If then If then naxnax ji modmod ji xx

n

i

n

iii xnax

1 1

mod

na n mod1

nxax

n

i

n

iii mod

1 1

nxxan

ii

n

ii

n mod11

Page 17: EULER AND FERMAT THEOREM

APPLICATIONS:APPLICATIONS:

Page 18: EULER AND FERMAT THEOREM

EXAMPLE :EXAMPLE :

1. Choose two large prime numbers P and Q.

2. Calculate N = P * Q.

3. Select the public key (i.e. the encryption key) E such that it is not a factor of (P-1)*(Q-1).

Let P = 7 , Q = 17Let P = 7 , Q = 17

Thus , N = 7 x 17 = 119Thus , N = 7 x 17 = 119

• Now (7-1) x (17-1) = 6 x 16 = 96.Now (7-1) x (17-1) = 6 x 16 = 96.• Factors of 96 are 2 and 3 (2 x 2 x 2 x 2 x 2 x 3).Factors of 96 are 2 and 3 (2 x 2 x 2 x 2 x 2 x 3).• E has to be prime to 96, let E = 5.E has to be prime to 96, let E = 5.

Page 19: EULER AND FERMAT THEOREM

EXAMPLE :EXAMPLE :

4. Select the private key (i.e. the decryption key) D suchthat the following equation is true :(D x E) mod (P-1) x (Q-1) = 1

5. For encryption, calculate the Cipher Text CT from thePlain Text PT as follows :CT = PTᴱ mod N.

• Substitute the values of E, P and Q in the equationSubstitute the values of E, P and Q in the equation• Let choose D = 77 sinceLet choose D = 77 since

(5 x 77) mod 96 = 385 mod 96 = 1(5 x 77) mod 96 = 385 mod 96 = 1Which satisfies the above condition.Which satisfies the above condition.

Page 20: EULER AND FERMAT THEOREM

EXAMPLE :EXAMPLE :

6. Send CT as the cipher text to the reciever.

Let us consider of encoding of alphabets Let us consider of encoding of alphabets as A = 1,as A = 1,B = 2, C = 3,….. , Z = 26.B = 2, C = 3,….. , Z = 26.We have to encrypt a single alphabet ‘F’ We have to encrypt a single alphabet ‘F’ (F = 6) using this scheme, with B’s public (F = 6) using this scheme, with B’s public key as 77 (known to A and B) and B’s key as 77 (known to A and B) and B’s private key as 5 (known only to B).private key as 5 (known only to B).

CT = PTCT = PTᴱ mod 119 = ᴱ mod 119 = mod 119 = mod 119 = 4141

56

Send 41 as the cipher text to the Send 41 as the cipher text to the reciever.reciever.

Page 21: EULER AND FERMAT THEOREM

EXAMPLE :EXAMPLE :

7. For decryption at the reciever, calculate the plain textPT from the cipher text CT as follows :PT = CTᴰ mod N.

PT = CTPT = CTᴰ mod 119 = mod 119 = 6ᴰ mod 119 = mod 119 = 6Which was the original plain text i.e. the code of Which was the original plain text i.e. the code of ‘F’.‘F’.

7741

Page 22: EULER AND FERMAT THEOREM

1.1. Encode the originalEncode the originalcharacter using A=1,character using A=1,B=2 etc.B=2 etc.

2. Raise the number to2. Raise the number topower E, here 5.power E, here 5.

3.3. Divide the result by 119Divide the result by 119and get the remainder.and get the remainder.The resulting number isThe resulting number isthe cipher text. the cipher text.

F 6

Results modulo 119= 41

Results modulo 1196 F

56F 41 F7741

1.1. Raise the number to theRaise the number to thepower D, here 77.power D, here 77.

2. Divide the result by 1192. Divide the result by 119and get the remainder.and get the remainder.The resulting number isThe resulting number isthe plain text.the plain text.

3.3. Decode the originalDecode the originalcharacter using 1=A,character using 1=A,2=B etc.2=B etc.

Encryption algorithm Encryption algorithm using the public keyusing the public key

Decryption algorithm Decryption algorithm using the private keyusing the private key

Page 23: EULER AND FERMAT THEOREM

SUMMARY :SUMMARY :

Firstly Prime Numbers, Prime Firstly Prime Numbers, Prime Factorization And Greatest Common Factorization And Greatest Common Divisor were discussed.Divisor were discussed.

Secondly Fermat’s Theorem and its Secondly Fermat’s Theorem and its proof is done.proof is done.

Then Euler Totient Function is Then Euler Totient Function is discussed.discussed.

Lastly Euler’s Theorem is discussed.Lastly Euler’s Theorem is discussed.

Page 24: EULER AND FERMAT THEOREM

REFERENCES :REFERENCES :

[1] Cryptography and Network Security [1] Cryptography and Network Security Principles and Practice, Fifth Edition, By: Principles and Practice, Fifth Edition, By: William Stallings.William Stallings.[2] Cryptography and Network Security, [2] Cryptography and Network Security, Chapter 9 Mathematics of Cryptography, Chapter 9 Mathematics of Cryptography, Part III: Primes and Related Congruence Part III: Primes and Related Congruence Equations, By: Behrouz Forouzan.Equations, By: Behrouz Forouzan.[3]L. Levine, \Fermat's Little Theorem: A [3]L. Levine, \Fermat's Little Theorem: A Proof by Function Iteration," Math. Mag. 72 Proof by Function Iteration," Math. Mag. 72 (1999), 308-309.(1999), 308-309.[4] C. Smyth, \A Coloring Proof of a [4] C. Smyth, \A Coloring Proof of a Generalisation of Fermat's Little Theorem," Generalisation of Fermat's Little Theorem," Amer. Math. MonthlyAmer. Math. Monthly93 (1986), 469-471.93 (1986), 469-471.

Page 25: EULER AND FERMAT THEOREM

THANK YOU.THANK YOU.