 So cryptographic methods like RSA and Elkamal and the Diffie-Hellman Key Exchange problem are all based around the idea that the discrete logarithm problem and its analogs are actually very difficult to solve. Well, let's see how we might actually solve them. So again, to place ourselves, the discrete logarithm problem emerges by analogy with the logarithms for real numbers. If a to power m is congruent, not equal, but congruent to b mod n, then we say that m is the discrete logarithm of b and where necessary mod n is specified. So the discrete logarithm problem is trying to find that value, and one standard method of solving it uses what's called the baby step giant step. And this is based on the following principle. Suppose I want to solve this discrete logarithm problem. What I'm going to do is I'm going to come up with two sets of numbers, and I'm going to look for a number that appears in both sets. This is an example of what's called a collision algorithm, and they are very efficient algorithms for solving certain types of problems. In particular case, I'm going to pick some value k. It doesn't really matter what it is, but I can treat it as some integer. And I'm going to evaluate the powers of a all the way up to power k minus one. I'm also going to evaluate the powers times b. b to power a to the minus k, b to power a to the minus 2k, and so on, all the way up to b to power minus rk, where I will stop when rk is greater than n. And then what I'm going to do is look for a value that's common to both lists. And if the discrete logarithm problem has a solution, there will be at least one value that does appear on both lists. Now you might think that's a pretty impressive claim, but actually it's fairly easy to see why that has to be true. Suppose that the two elements that are the same are a to some power n and b a to some power minus m times k. Because they're the same, they're going to be equivalent, and what I can do is I can multiply both sides by a to power mk, and to get a to the power mk plus n congruent to b mod n. And so there's my solution mk plus n to the discrete logarithm problem. Now why does that work? Well I know that if any value makes this true, then I can consider what that value is divided by k. And when I do that division, what I get is some quotient, which is going to be m in this case, and some remainder, n. Any number when I divide by k gives me a quotient and remainder. And what this baby step, giant step approach does is it identifies the quotient and remainder separately as a way of solving the discrete logarithm problem. For example, let's say I want to solve 3 to power x congruent to 19 mod 59. So I'll pick a number, how about k equals 5, and I'm going to evaluate 3 to power i for all my numbers up to k minus 1. So that's going to be 3, 9, 27, and so on. I also want to evaluate 19 times 3 to power negative 5, negative 10, negative 15, and so on. So I'm going to evaluate all those negative powers. So the thing to start with, I might want to start by finding 3 to power negative 5 first. So the inverse of 3, mod 59 is 20, to the fifth power is 17, and so I can find 19 times 3 to the negative 5, and 3 to the 10th, 19 times 3 to the 10th, 3 to the 15th, 19 times 3 to the 15th. And I can actually stop at this point because now I have a match. This is 9, and so is this. So I can stop and compare just those two values, and because they are congruent, mod 59, I can rewrite them, 3 to power 17, is going to be 19, and there's my solution. Well, you might be worried that we picked k equals 5 initially, and maybe that has something to do with our ability to find the solution. Well, it doesn't really matter. Suppose I choose k equals 8, for example. So I'm going to find the powers of 3 from 1 to 7. So there they are. And then now I want to find the inverse of 3 to power 8. So that's going to be 5, and again I can find the powers of 3 to the negative 8 times 19. So I'll find those numbers again. 19 times 3 to the 8th, 3 to the 16th, and well there's my congruence. This is 3, this is 3. So again, if I just focus on the ones that are the same, I have 3 congruent to 19 times 3 to power 16, and multiplying both sides by 3 to power 16 gives me my solution once again. So it doesn't really make a difference what we choose as k.