Notepad/enter/Machine Tips (Quantum)/Resources/Concepts Review/Math/Proof of a formula for modu...

54 lines
1.4 KiB
Markdown
Raw Permalink Normal View History

2023-08-18 23:30:13 +00:00
$$16^{54} \ mod \ 17=3^{24×54} \ mod \ 17 $$
Why?
[Public Key Cryptography: Diffie-Hellman Key Exchange (short version) - YouTube](https://www.youtube.com/watch?v=3QnD2c4Xovk) is a good video to understand asymmetric cryptography. There is a jump from 4:34 in the video that is not obvious to everyone.
The jump is from 1654mod17 to 324×54mod17, but why? From the comments of video, Im not the only one who is supprised by this jump.
First let me introduce a formula:
$$a^b\ mod \ p=((a \ mod \ p)^b) \ mod \ p \ \ \ \ (1)$$
Then the proof:
There must be one integer `n` to have
$$a \ mod \ p=anp \ \ \ \ (2)$$
so
$$((a \ mod \ p)^b) \ mod \ p=((anp)^b) \ mod \ p$$
With [Binomial theorem - Wikipedia](https://en.wikipedia.org/wiki/Binomial_theorem),
$$(anp)b=ab+(b1)ab1(np)+(b2)ab2(np)2+...+(np)b$$
We could see that all items are times of `p` except $a^b$,
$$((anp)bmodp)=(ab+(b1)ab1(np)+(b2)ab2(np)2+...+(np)b)modp=abmodp+0+0+...+0$$
Now we got
$$((anp)^b \ mod \ p)=a^b \ mod \ p$$
Use formula (2)
$$((amodp)b)modp=abmodp$$
Now let a as $3^{24}$, and b as 54 in formula (1):
2023-08-19 00:00:32 +00:00
$$
\\
\\begin{align}
3^{24×54}\ mod \ 17=((3^{24})^{54}) \ mod \ 17 \\ \\&= ((3^{24} \ mod \17)^{54})mod 17
\end{align}
2023-08-19 00:30:43 +00:00
= 16^{54}mod17$$
via [BrookHongs github](https://brookhong.github.io/2018/05/22/proof-of-a-formula-for-modulo.html)