In
mathematics
Mathematics is a field of study that discovers and organizes methods, Mathematical theory, theories and theorems that are developed and Mathematical proof, proved for the needs of empirical sciences and mathematics itself. There are many ar ...
, for given
real number
In mathematics, a real number is a number that can be used to measure a continuous one- dimensional quantity such as a duration or temperature. Here, ''continuous'' means that pairs of values can have arbitrarily small differences. Every re ...
s
and
, the
logarithm
In mathematics, the logarithm of a number is the exponent by which another fixed value, the base, must be raised to produce that number. For example, the logarithm of to base is , because is to the rd power: . More generally, if , the ...
is a number
such that
. Analogously, in any
group , powers
can be defined for all
integer
An integer is the number zero (0), a positive natural number (1, 2, 3, ...), or the negation of a positive natural number (−1, −2, −3, ...). The negations or additive inverses of the positive natural numbers are referred to as negative in ...
s
, and the discrete logarithm
is an integer
such that
. In
arithmetic modulo an integer
, the more commonly used term is index: One can write
(read "the index of
to the base
modulo
") for
if
is a
primitive 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 the
Diffie–Hellman problem. Several important
algorithm
In mathematics and computer science, an algorithm () is a finite sequence of Rigour#Mathematics, mathematically rigorous instructions, typically used to solve a class of specific Computational problem, problems or to perform a computation. Algo ...
s in
public-key cryptography
Public-key cryptography, or asymmetric cryptography, is the field of cryptographic systems that use pairs of related keys. Each key pair consists of a public key and a corresponding private key. Key pairs are generated with cryptographic alg ...
, such as
ElGamal, base their security on the
hardness assumption that the discrete logarithm problem (DLP) over carefully chosen groups has no efficient solution.
Definition
Let
be any group. Denote its
group operation
In mathematics, a group is a set with an operation that combines any two elements of the set to produce a third element within the same set and the following conditions must hold: the operation is associative, it has an identity element, and ev ...
by multiplication and its
identity element
In mathematics, an identity element or neutral element of a binary operation is an element that leaves unchanged every element when the operation is applied. For example, 0 is an identity element of the addition of real numbers. This concept is use ...
by
. Let
be any element of
. For any positive integer
, the expression
denotes the product of
with itself
times:
:
Similarly, let
denote the product of
with itself
times. For
, the
th power is the identity:
.
Let
also be an element of
. An integer
that solves the equation
is termed a discrete logarithm (or simply logarithm, in this context) of
to the base
. One writes
.
Examples
Powers of 10
The
powers 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 the
exponential function.
In
group-theoretic terms, the powers of 10 form a
cyclic group
In abstract algebra, a cyclic group or monogenous group is a Group (mathematics), group, denoted C_n (also frequently \Z_n or Z_n, not to be confused with the commutative ring of P-adic number, -adic numbers), that is Generating set of a group, ge ...
under multiplication, and 10 is a
generator for this group. The discrete logarithm
is defined for any
in
.
Powers of a fixed real number
A similar example holds for any non-zero real number
. The powers form a multiplicative
subgroup
In group theory, a branch of mathematics, a subset of a group G is a subgroup of G if the members of that subset form a group with respect to the group operation in G.
Formally, given a group (mathematics), group under a binary operation  ...
of the non-zero real numbers. For any element
of
, one can compute
.
Modular arithmetic
One of the simplest settings for discrete logarithms is the group
Z''p''×. This is the group of multiplication
modulo
In computing and mathematics, the modulo operation returns the remainder or signed remainder of a division, after one number is divided by another, the latter being called the '' modulus'' of the operation.
Given two positive numbers and , mo ...
the
prime
A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only ways ...
. Its elements are non-zero
congruence classes modulo
, and the group product of two elements may be obtained by ordinary integer multiplication of the elements followed by reduction modulo
.
The
th power 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 called
modular exponentiation
Modular exponentiation is exponentiation performed over a modulus. It is useful in computer science, especially in the field of public-key cryptography, where it is used in both Diffie–Hellman key exchange and RSA public/private keys.
Modula ...
. For example, consider Z
17×. To compute
in this group, compute
, and then divide
by
, obtaining a remainder of
. Thus
in the group Z
17×.
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 from
Fermat's little theorem
In number theory, Fermat's little theorem states that if is a prime number, then for any integer , the number is an integer multiple of . In the notation of modular arithmetic, this is expressed as
a^p \equiv a \pmod p.
For example, if and , t ...
— 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
.
Powers of the identity
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
.
Properties
Powers obey the usual algebraic identity
.
In other words, the
function
:
defined by
is a
group homomorphism
In mathematics, given two groups, (''G'',∗) and (''H'', ·), a group homomorphism from (''G'',∗) to (''H'', ·) is a function ''h'' : ''G'' → ''H'' such that for all ''u'' and ''v'' in ''G'' it holds that
: h(u*v) = h(u) \cdot h(v)
whe ...
from the group of integers
under addition
onto
In mathematics, a surjective function (also known as surjection, or onto function ) is a function such that, for every element of the function's codomain, there exists one element in the function's domain such that . In other words, for a f ...
the
subgroup
In group theory, a branch of mathematics, a subset of a group G is a subgroup of G if the members of that subset form a group with respect to the group operation in G.
Formally, given a group (mathematics), group under a binary operation  ...
of
generated by
. For all
in
,
exists.
Conversely,
does not exist for
that are not in
.
If
is
infinite, then
is also unique, and the discrete logarithm amounts to a
group isomorphism
In abstract algebra, a group isomorphism is a function between two groups that sets up a bijection between the elements of the groups in a way that respects the given group operations. If there exists an isomorphism between two groups, then the ...
:
On the other hand, if
is
finite of
order , then
is 0 unique only up to
congruence 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
:
Algorithms
The discrete logarithm problem is considered to be computationally intractable. That is, no efficient classical algorithm is 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 called ''trial multiplication''. It requires
running time linear
In mathematics, the term ''linear'' is used in two distinct senses for two different properties:
* linearity of a '' function'' (or '' mapping'');
* linearity of a '' polynomial''.
An example of a linear function is the function defined by f(x) ...
in the size of the group
and thus
exponential 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 for
integer factorization
In mathematics, integer factorization is the decomposition of a positive integer into a product of integers. Every positive integer greater than 1 is either the product of two or more integer factors greater than 1, in which case it is a comp ...
. These algorithms run faster than the naïve algorithm, some of them proportional to the
square root
In mathematics, a square root of a number is a number such that y^2 = x; in other words, a number whose ''square'' (the result of multiplying the number by itself, or y \cdot y) is . For example, 4 and −4 are square roots of 16 because 4 ...
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 in
polynomial time
In theoretical computer science, the time complexity is the computational complexity that describes the amount of computer time it takes to run an algorithm. Time complexity is commonly estimated by counting the number of elementary operations p ...
(in the number of digits in the size of the group).
*
Baby-step giant-step
*
Function field sieve
*
Index calculus algorithm
*
Number field sieve
*
Pohlig–Hellman algorithm
*
Pollard's rho algorithm for logarithms
*
Pollard's kangaroo algorithm (aka Pollard's lambda algorithm)
There is an efficient
quantum algorithm
In quantum computing, a quantum algorithm is an algorithm that runs on a realistic model of quantum computation, the most commonly used model being the quantum circuit model of computation. A classical (or non-quantum) algorithm is a finite seq ...
due to
Peter Shor
Peter Williston Shor (born August 14, 1959) is an American theoretical computer scientist known for his work on quantum computation, in particular for devising Shor's algorithm, a quantum algorithm for factoring exponentially faster than the ...
.
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. The
extended Euclidean algorithm
In arithmetic and computer programming, the extended Euclidean algorithm is an extension to the Euclidean algorithm, and computes, in addition to the greatest common divisor (gcd) of integers ''a'' and ''b'', also the coefficients of Bézout's id ...
finds
quickly.
With
Diffie–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 sufficiently
smooth, i.e. has no large
prime factor
A prime number (or a prime) is a natural number greater than 1 that is not a product of two smaller natural numbers. A natural number greater than 1 that is not prime is called a composite number. For example, 5 is prime because the only ways ...
s.
Comparison with integer factorization
While computing discrete logarithms and integer factorization are distinct problems, they share some properties:
* both are special cases of the
hidden subgroup problem for
finite abelian groups,
* both problems seem to be difficult (no efficient algorithms are known for non-
quantum computers),
* for both problems efficient algorithms on quantum computers are known,
* algorithms from one problem are often adapted to the other, and
* the difficulty of both problems has been used to construct various
cryptographic
Cryptography, or cryptology (from "hidden, secret"; and ''graphein'', "to write", or '' -logia'', "study", respectively), is the practice and study of techniques for secure communication in the presence of adversarial behavior. More gen ...
systems.
Cryptography
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 the
average-case complexity
In computational complexity theory, the average-case complexity of an algorithm is the amount of some computational resource (typically time) used by the algorithm, averaged over all possible inputs. It is frequently contrasted with worst-case comp ...
can be shown to be about as hard as the worst case using
random self-reducibility.
At the same time, the inverse problem of discrete exponentiation is not difficult (it can be computed efficiently using
exponentiation by squaring, for example). This asymmetry is analogous to the one between integer factorization and integer multiplication. Both asymmetries (and other possibly
one-way function
In computer science, a one-way function is a function that is easy to compute on every input, but hard to invert given the image of a random input. Here, "easy" and "hard" are to be understood in the sense of computational complexity theory, s ...
s) 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
Diffie–Hellman (DH) key exchangeSynonyms of Diffie–Hellman key exchange include:
* Diffie–Hellman–Merkle key exchange
* Diffie–Hellman key agreement
* Diffie–Hellman key establishment
* Diffie–Hellman key negotiation
* Exponential ke ...
, and the
Digital Signature Algorithm
The Digital Signature Algorithm (DSA) is a Public-key cryptography, public-key cryptosystem and Federal Information Processing Standards, Federal Information Processing Standard for digital signatures, based on the mathematical concept of modular e ...
) and cyclic subgroups of
elliptic curve
In mathematics, an elliptic curve is a smooth, projective, algebraic curve of genus one, on which there is a specified point . An elliptic curve is defined over a field and describes points in , the Cartesian product of with itself. If the ...
s over
finite field
In mathematics, a finite field or Galois field (so-named in honor of Évariste Galois) is a field (mathematics), field that contains a finite number of Element (mathematics), elements. As with any field, a finite field is a Set (mathematics), s ...
s (''see''
Elliptic curve cryptography
Elliptic-curve cryptography (ECC) is an approach to public-key cryptography based on the algebraic structure of elliptic curves over finite fields. ECC allows smaller keys to provide equivalent security, compared to cryptosystems based on modula ...
).
While there is no publicly known algorithm for solving the discrete logarithm problem in general, the first three steps of the
number field sieve algorithm only depend on the group
, not on the specific elements of
whose finite
is desired. By
precomputing 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.
[
It turns out that much ]internet
The Internet (or internet) is the Global network, global system of interconnected computer networks that uses the Internet protocol suite (TCP/IP) to communicate between networks and devices. It is a internetworking, network of networks ...
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. The Logjam 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 called export grade.[
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 national ]intelligence agency
An intelligence agency is a government agency responsible for the collection, Intelligence analysis, analysis, and exploitation of information in support of law enforcement, national security, military, public safety, and foreign policy obj ...
such as the U.S. National Security Agency
The National Security Agency (NSA) is an intelligence agency of the United States Department of Defense, under the authority of the director of national intelligence (DNI). The NSA is responsible for global monitoring, collection, and proces ...
(NSA). The Logjam authors speculate that precomputation against widely reused 1024 DH primes is behind claims in leaked NSA documents that NSA is able to break much of current cryptography.
See also
* A. W. Faber Model 366
* Percy Ludgate and Irish logarithm
References
*
*
Further reading
* Richard Crandall; Carl Pomerance. Chapter 5, ''Prime Numbers: A computational perspective'', 2nd ed., Springer.
*
{{DEFAULTSORT:Discrete Logarithm
Modular arithmetic
Group theory
Cryptography
Logarithms
Finite fields
Computational hardness assumptions
Unsolved problems in computer science