Lecture12 - Lecture 12 Discrete Logarithms RSA...

This preview shows pages 1–2. Sign up to view the full content.

Lecture 12: Discrete Logarithms, RSA, Diffie-Hellman Key Exchange Calculating Modular Exponents Before we move on, one quick note about computation. Let's consider the amount of work involved in exponentiation: Consider calculating a n-1 (mod n), for a large value of n, perhaps with about 100 bits. An iterative algorithm where you successively multiply values of a to an accumulator variable won't suffice. However, fast exponentiation, will work: Power(base, exp, mod) { if (exp == 0) return 1; if (exp == 1) return base%mod; if (exp%2 == 0) { int temp = Power(base, exp/2, mod); return (temp*temp)%mod; } return (base*Power(base, exp-1, mod))%mod; } Basically, what we do here is cut our exponent down by half for each two iterations of this algorithm. That means that we will do the operation of multiplying and modding only about 200 times at most if n is 100 bits, as opposed to doing it 2 100 times which is far worse. For a quick analysis of the time complexity, multiplying two integers of n bits takes O(n 2 ) and we will do this O(n) times in fast exponentiation for a total time of O(n 3 ) in the number of bits of the numbers being multiplied. If n is the number itself, then the amount of time is O(log 3 n). Discrete Logs A normal logarithm is defined as follows: log b a = c is equivalent to the exponential statement b c =a. Basically, if you are given a and b, you have to determine which power to raise b to in order to get the result a.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern