When the modulus m is a product of distinct primes, the decryption will always work
April 25, 2020 | 2 min read
As long as m is a product of distinct primes, the decryption will always work even the message a and the modulus m are not relatively prime. i.e.
aed≡a (mod m) ∀a∈Z where1. 2. m=p1p2…pr, pi are all distinct primesgcd(e,ϕ(m))=1,ed−ϕ(m)v=1 where e,d,v∈Z+Proof:
∵m=p1p2…pr
∴ϕ(m)=(p1−1)(p2−1)⋯(pr−1) (Euler’s phi function formula)
∴ed=1+v(p1−1)(p2−1)⋯(pr−1)
If gcd(a,pi)=1, by Fermat’s little theorem, api−1≡1 (mod pi). Then,
aed−a≡a1+v(p1−1)(p2−1)…(pr−1)−a (mod pi)≡a(av(p1−1)(p2−1)…(pr−1))−a (mod pi)≡a−a (mod pi)≡0 (mod pi)If gcd(a,pi)=1, then gcd(a,pi)=pi since pi is a prime number and gcd(a,pi)=1 or pi and hence a is a multiple of pi.
∴aed−a≡0−0≡0 (mod pi)
So, whether a and pi are relatively prime or not, we always have
aed−a≡0 (mod pi)⟺aed≡a (mod pi) ∀i=1,2,…,rSince pi are all distinct prime numbers, we have aed≡a (mod p1p2…pr) and hence aed≡a (mod m) ∀a∈Z.