Modular exponentiation with Chinese Remainder Theorem

3.5k Views Asked by At

I'm learning modular exponentiation with Chinese remainder theorem.

I found a great answer from below

https://crypto.stackexchange.com/questions/5296/how-can-i-use-eulers-totient-and-the-chinese-remainder-theorem-for-modular-expon

But I can't understand the last step of construction from Cp and Cq very well. Can someone explain it to me? Moreover, if I make N = 55 = 11 x 5 instead of 5 x 11, that last step fails to give correct answer.

The last step:

M^e mod pq=Cq+q⋅((Cp−Cq)mod p)

1

There are 1 best solutions below

0
On

That answer employs a form of the Chinese Remainder Theorem (CRT) that I call Easy CRT. Below is a complete proof. You can find many example applications in prior posts here.

Theorem $\:$ (Easy CRT) $\rm\ \ $ If $\rm\ m,\:n\:$ are coprime integers then $\rm\ m^{-1}\ $ exists $\rm\ (mod\ n)\ \ $ and

$\rm\displaystyle\quad\quad\quad\quad\quad \begin{eqnarray}\rm x&\equiv&\rm\ a\ (mod\ m) \\ \rm x&\equiv&\rm\ b\ (mod\ n)\end{eqnarray} \ \iff\ \ x\ \equiv\ a + m\ \bigg[\frac{b-a}{m}\ mod\ n\:\bigg]\ \ (mod\ m\:n)$

Proof $\rm\,\ m,n\,$ coprime $\,\rm\Rightarrow\, \color{#c00}{m' \equiv m^{-1}}\pmod n $ exists, by Bezout or by Euler's $\phi$ Theorem.

$\rm\ (\Leftarrow)\ \ \ mod\ m:\ x\ \equiv\ a + m\ [\color{#c00}m'(b\!-\!a)]\ \equiv\ a\:,\ $ and $\rm\,\ mod\ n\!\!:\ x\ \equiv\ a + m\color{#c00}{m'}(b-a)\ \equiv\ b\:.$

$\rm (\Rightarrow)\ \ $ The solution is unique $\rm\ (mod\ m\:n)\ $ since if $\rm\ x',\:x\ $ are solutions then $\rm\ x'\equiv x\ $ mod $\rm\:m,n\:$ therefore $\rm\ m,\:n\ |\ x'-x\ \Rightarrow\ m\:n\ |\ x'-x\ \ $ since $\rm\ \:m,\:n\:$ coprime $\rm\:\Rightarrow\ lcm(m,n) = m\:n\:.\ \, $ QED