Modular Arithmetic and Primality
Modular Arithmetic and Primality
Modular Arithmetic and Primality
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
There is a faster algorithm<br />
– Rather than multiply, square x each time <strong>and</strong> multiply the powers<br />
corresponding to 1’s in the binary representation of y.<br />
– x mod N -> x 2 mod N -> x 4 mod N -> x 8 mod N -> x log(y) mod N<br />
– Thus there are only log 2 (y) multiplications<br />
– Then take the product of the appropriate powers<br />
– x 21 : change the 21 to binary: 10101 2<br />
– x 10101 = x 10000 · x 100 · x 1 (binary) = x 16 · x 4 · x 1 = x 21<br />
CS 312 - Complexity Examples - <strong>Arithmetic</strong> <strong>and</strong> RSA 21