We know that most public cryptosystems are based on hard computational problems. One of them is the discrete logarithm problem. Let's find out about it.
The general statement
Suppose we have some finite cyclic group , written multiplicatively. Let's recall that a cyclic group means that there is an element called a generator, such that every element of the group is some power of : . So, a cyclic group of order (containing elements) looks like
When we work with real numbers, the power to which we have to raise a real number to produce a real number , is called the logarithm of to base and denoted as . We can also refer to it as a discrete logarithm of (to base ) and write this as .
You can notice that, if in , then also . So, if we want the discrete logarithm of (to base ) to be unique, we should refine the definition a bit:
Definition. Let be a cyclic group with a generator . The discrete logarithm of to base is the least non-negative integer such that
The question is: can we efficiently find this discrete logarithm , knowing and ?
The word "efficiently" is crucial here. No doubt we can begin to patiently check all possible powers, computing for and comparing the result to . Sooner or later, we'll encounter our (remember that is a generator). But it can be later rather than sooner. For a huge group and an unlucky choice of , thousands of years may pass before we'll find through this trial-and-error process.
Do we know an efficient algorithm for the problem of finding the discrete logarithm (which is called the discrete logarithm problem, or simply DLP)? It depends on the group .
When DLP is easy
The first example of a finite cyclic group is — integers modulo with respect to addition. We can write its elements as or as Since in this topic we will often switch between different values of , we will prefer the second form of notation, although it may seem cumbersome.
For every , is a generator in — every other element of this group can be presented as a sum of instances of .
For example, if and , we immediately notice that and can conclude that .
Of course, finding a logarithm in is especially easy with . But even if we chose another generator for , say, or , the discrete logarithm problem wouldn't become much harder. In fact, for any , finding in requires just solving a congruence
It can can be done efficiently using extended Euclid's algorithm.
When DLP is hard
We considered as an example above. Now let's look at another cyclic group of the same order:
It is the group of non-zero integers modulo 101 with respect to multiplication, and it's also cyclic. The last claim is certainly not obvious and follows from the theory of finite fields. In fact, for any prime number is a cyclic group of order , that is, all its elements are powers of some . For you can take, for instance, as a generator (but there are other elements that can play this role).
Now, what is for some — say, ? It's an integer such that
For , you can just check all possible 's using your computer (you have to try only 's from 1 to 100). But what about finding a discrete logarithm in if is really huge? It turns out there is no efficient (that is, requiring a reasonable amount of time) algorithm to solve such congruences. To be more precise, nobody has invented this algorithm, as well as nobody has proved it doesn't exist. But nonetheless, the lack of known efficient algorithms for DLP in gives an opportunity to build some cryptographic protocols.
To be more concrete about inefficiency of the currently known algorithms, we can say that for now, discrete logarithm computation in for 795-bit (not so long a number, in fact — roughly 240 decimal digits) is considered a record.
There are other groups where the discrete logarithm problem is hard, and some cryptographic protocols initially developed for can be modified to work with such groups. An especially interesting example — or, rather, a range of examples — is provided by so-called elliptic curves (google these words if you're not afraid to see how abstract algebra meets geometry!)
An important point is that in a group with known generator , we can quickly find if we know . But the recovery of from known and becomes — in a suitable — a hard problem. The cases when a problem has an efficient algorithm, but the inverse problem has none, are loved by cryptographers. An honest user of a cryptosystem has to solve an easy problem, while the adversary has to crack the hard inverse.
Conclusion
The discrete logarithm problem (DLP) in a finite group with the generator consists in finding the least non-negative integer , such that is equal to a given .
There are some groups, for which we can solve DLP efficiently.
But in the general case, and, in particular, in for a prime , DLP is considered a hard problem, for which no one knows an effective algorithm.
It is not proven yet that the effective algorithm can't exist. But all efforts to find such an algorithm haven't been fruitful so far.
It's easy to raise an element of a cyclic group to some known power, but it's hard to find the discrete logarithm. This allows to build some cryptographic protocols.