01.01.2015 Views

Modular Arithmetic and Primality

Modular Arithmetic and Primality

Modular Arithmetic and Primality

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!