Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

Euler’s Toitient Theorem, Fermat

Theorem, Discrete logarithms calculation


Euler’s Toitient theorem
It states that, if n is a positive integer and x, n
are coprime, then xφ(n) ≡ 1 mod n where φ(n) is
the Euler's totient function.
• xφ(n) ≡ 1 mod n means that, xφ(n) mod n =1
mod n
• Coprime means that the two numbers have
only one common gcd that is 1.
• φ(n) calculation:
counts the number of integers between 1
and n inclusive(less than n), which are coprime to n.
• For example,
φ(5)={1,2,3,4}=4
φ(6)={1,5}=2
• For prime number of n, the result of φ(n) is n-1
• otherwise,
φ(n)= φ(a) * φ(b) [a,b must be coprime]
For example, φ(35)= φ(5) * φ(7)
=4*6
=24
Example:
• Let x=11, n=10 and both are coprime, the we can write,

xφ(n) ≡ 1 mod n
⇒ 11 φ(n) ≡ 1 mod 10
⇒ 11 4 ≡ 1 mod 10 (as, φ(10) =4 )
⇒ 14641 ≡ 1 mod 10
⇒ 14641 mod 10= 1 mod 10

• x φ(n)*a ≡ 1 mod 10
For example, 11 φ(10)*2 ≡ 1 mod 10
=> 11 8 ≡ 1 mod 10
[as, φ(10) =4; 11 4*2 = 11 8 ]
=>214,358,881≡ 1 mod 10
Application of Euler’s Toitient Theorem
• The security of the RSA cryptosystem lies in an
algorithm based on Euler's Theorem. This
cryptosystem has proven to be unbreakable,
as long as it is implemented correctly, for over
30 years.
• Primality testing (ap-1 = 1 (mod p))
• Fifth root party trick.
Euler's Totient Theorem is a fundamental concept in number theory and
is used in RSA (Rivest-Shamir-Adleman), a widely used asymmetric
encryption algorithm, for several critical reasons:

Key Pair Generation:


● RSA key pairs consist of a public key and a private key.
● The public key consists of two values: n (a product of two
prime numbers) and e (an integer coprime to (p-1)(q-1)
where p and q are the prime factors of n).
● Euler's Totient Theorem helps in selecting suitable values for e
that are relatively prime to (p-1)(q-1), ensuring that
encryption is reversible.
Encryption and Decryption:
● In RSA encryption, a message M is encrypted using the recipient's
public key as C ≡ M^e (mod n).
● Euler's Totient Theorem helps ensure that the decryption operation,
C^d ≡ M (mod n) (where d is the private exponent), can correctly
recover the original message M.
Security:
● Euler's Totient Theorem plays a role in the security of RSA. It ensures
that the private key is computationally hard to determine from the
public key.
● The difficulty of factoring the product of two large primes ( n) and
finding d is a key factor in the security of RSA. Euler's Totient
Theorem is used to establish the relationship between e, d, and (p-1)
(q-1), making it challenging to compute d without knowing the
prime factors p and q.
Fermat’s Theorem
• Fermat’s Theorem is also known as Fermat’s
little theorem.
• The theorem states that, for any prime
number ‘n’ and any integer ‘x’ such that ‘x’ is
not divisible by ‘n’, then xn-1 ≡ 1 mod n
• Fermat theorem is a special case of Euler’s
theorem.
Example

• X=3, n=5
⇒35-1 =34 =81
⇒81 ≡ 1 mod 5
⇒ 81 mod 5= 1 mod 5
• Another form of Fermat theorem is, xn ≡ x
mod n
• xn-1 ≡ 1 mod n
⇒xn .x-1 ≡ 1 mod n
⇒xn≡ x mod n
Example
1. X=3, n=5
=> xn = 35 =243 ≡ 3 mod 5

2. x= 5 ,n=2
=> xn =52 =25≡ 5 mod 2
Application of Fermat Theorem
• Primality testing
• Public key cryptography
• Base of RSA
• It’s often used to prove identity
Discrete logarithms calculation
gn mod P= x
• Here, g is primitive root or generator of P;(P is
a prime number)
• n can be any integer value and n is greater
than 1 to any range.
• We can write the equation this way,
logg x=n mod p
Example

Q1. 23 mod 7= ?
Ans: 1
Q2. solve log2 9 mod 11
Ans: P=11, g=2, x=9
⇒2n mod 11=9
Try n=1,2,3,4,……
n= 6
• It is easy to solve when we know the n and have to
calculate x .
• But when we have to find out n for given x then it
can be hard when P is large. Then the needed time
and effort is huge.
• That’s why it is called one way function and the
strength of this function depends on how much
time it takes to break it.
• It is used in ElGamal encryption, Diffie-Hellman key
exchange and digital signature algorithm.

You might also like