
Inmathematics, for givenreal numbers and, thelogarithm is a number such that. Thediscrete logarithm generalizes this concept to acyclic group. A simple example is the group ofintegersmodulo a prime number (such as 5) undermodular multiplication of nonzero elements.
For instance, take in the multiplicative group modulo 5, whose elements are. Then:The powers of 2 modulo 5 cycle through all nonzero elements, so discrete logarithms exist and are given by:
More generally, in anygroup, powers can be defined for allintegers, and thediscrete logarithm is an integer such that. Inarithmetic modulo an integer, the more commonly used term isindex: One can write (read "the index of to the base modulo") for if is aprimitive root of and.
Discrete logarithms are quickly computable in a few special cases. However, no efficient method is known for computing them in general. In cryptography, the computational complexity of the discrete logarithm problem, along with its application, was first proposed in theDiffie–Hellman problem. Several importantalgorithms inpublic-key cryptography, such asElGamal, base their security on thehardness assumption that the discrete logarithm problem (DLP) over carefully chosen groups has no efficient solution,[1] and in a generalblack box group lacks asubexponential solution at all.[2]
Let be any group. Denote itsgroup operation by multiplication and itsidentity element by. Let be any element of. For any positive integer, the expression denotes the product of with itself times:[3]
Similarly, let denote the product of with itself times. For, theth power is the identity:.
Let also be an element of. An integer that solves the equation is termed adiscrete logarithm (or simplylogarithm, in this context) of to the base. One writes.
Thepowers of 10 are
For any number in this list, one can compute. For example,, and. These are instances of the discrete logarithm problem.
Other base-10 logarithms in the real numbers are not instances of the discrete logarithm problem, because they involve non-integer exponents. For example, the equation means that. While integer exponents can be defined in any group using products and inverses, arbitrary real exponents, such as this 1.724276…, require other concepts such as theexponential function.
Ingroup-theoretic terms, the powers of 10 form acyclic group under multiplication, and 10 is agenerator for this group. The discrete logarithm is defined for any in.
A similar example holds for any non-zero real number. The powers form a multiplicativesubgroup of the non-zero real numbers. For any element of, one can compute.
One of the simplest settings for discrete logarithms is the groupZp×. This is the group of multiplicationmodulo theprime. Its elements are non-zerocongruence classes modulo, and the group product of two elements may be obtained by ordinary integer multiplication of the elements followed by reduction modulo .
Thethpower of one of the numbers in this group may be computed by finding its 'th power as an integer and then finding the remainder after division by. When the numbers involved are large, it is more efficient to reduce modulo multiple times during the computation. Regardless of the specific algorithm used, this operation is calledmodular exponentiation. For example, considerZ17×. To compute in this group, compute, and then divide by, obtaining a remainder of. Thus in the groupZ17×.
The discrete logarithm is just the inverse operation. For example, consider the equation. From the example above, one solution is, but it is not the only solution. Since —as follows fromFermat's little theorem— it also follows that if is an integer then. Hence the equation has infinitely many solutions of the form. Moreover, because is the smallest positive integer satisfying, these are the only solutions. Equivalently, the set of all possible solutions can be expressed by the constraint that.
In the special case where is the identity element of the group, the discrete logarithm is undefined for other than, and every integer is a discrete logarithm for.
Powers obey the usual algebraic identity.[3] In other words, thefunction
defined by is agroup homomorphism from the group of integers under additiononto thesubgroup ofgenerated by. For all in, exists.Conversely, does not exist for that are not in.
If isinfinite, then is also unique, and the discrete logarithm amounts to agroup isomorphism
On the other hand, if isfinite oforder, then is 0 unique only up tocongruence modulo, and the discrete logarithm amounts to a group isomorphism
where denotes the additive group of integers modulo.
The familiar base change formula for ordinary logarithms remains valid: If is another generator of, then
The discrete logarithm problem is considered to be computationally intractable. For a classical (e.g., non-quantum) computer, no efficient (polynomial-time) algorithm is yet known for computing discrete logarithms in general.
A general algorithm for computing in finite groups is to raise to larger and larger powers until the desired is found. This algorithm is sometimes calledtrial multiplication. It requiresrunning timelinear in the size of the group and thusexponential in the number of digits in the size of the group. Therefore, it is an exponential-time algorithm, practical only for small groups.
More sophisticated algorithms exist, usually inspired by similar algorithms forinteger factorization. These algorithms run faster than the naïve algorithm, some of them proportional to thesquare root of the size of the group, and thus exponential in half the number of digits in the size of the group. However, none of them runs inpolynomial time (in the number of digits in the size of the group).
There is an efficientquantum algorithm due toPeter Shor.[4]
Efficient classical algorithms also exist in certain special cases. For example, in the group of the integers modulo under addition, the power becomes a product, and equality means congruence modulo in the integers. Theextended Euclidean algorithm finds quickly.
WithDiffie–Hellman, a cyclic group modulo a prime is used, allowing an efficient computation of the discrete logarithm with Pohlig–Hellman if the order of the group (being) is sufficientlysmooth, i.e. has no largeprime factors.
While computing discrete logarithms and integer factorization are distinct problems, they share some properties:
There exist groups for which computing discrete logarithms is apparently difficult. In some cases (e.g. large prime order subgroups of groups) there is not only no efficient algorithm known for the worst case, but theaverage-case complexity can be shown to be about as hard as the worst case usingrandom self-reducibility.[5]
At the same time, the inverse problem of discrete exponentiation is not difficult (it can be computed efficiently usingexponentiation by squaring, for example). This asymmetry is analogous to the one between integer factorization and integer multiplication. Both asymmetries (and other possiblyone-way functions) have been exploited in the construction of cryptographic systems.
Popular choices for the group in discrete logarithm cryptography (DLC) are the cyclic groups (e.g.ElGamal encryption,Diffie–Hellman key exchange, and theDigital Signature Algorithm) and cyclic subgroups ofelliptic curves overfinite fields (seeElliptic curve cryptography).
While there is no publicly known algorithm for solving the discrete logarithm problem in general, the first three steps of thenumber field sieve algorithm only depend on the group, not on the specific elements of whose finite is desired. Byprecomputing these three steps for a specific group, one need only carry out the last step, which is much less computationally expensive than the first three, to obtain a specific logarithm in that group.[6]
It turns out that muchinternet traffic uses one of a handful of groups that are of order 1024 bits or less, e.g. cyclic groups with order of the Oakley primes specified in RFC 2409.[7] TheLogjam attack used this vulnerability to compromise a variety of internet services that allowed the use of groups whose order was a 512-bit prime number, so calledexport grade.[6]
The authors of the Logjam attack estimate that the much more difficult precomputation needed to solve the discrete log problem for a 1024-bit prime would be within the budget of a large nationalintelligence agency such as the U.S.National Security Agency (NSA). The Logjam authors speculate that precomputation against widely reused 1024 DH primes is behind claims inleaked NSA documents that NSA is able to break much of current cryptography.[6]