Description
Diffie–Hellman establishes a shared secret that can be used for secret communications by exchanging data over a public network. The following diagram illustrates the general idea of the key exchange by using colours instead of a very large number. The key part of the process is that Alice and Bob exchange their secret colours in a mix only. Finally this generates an identical key that is mathematically difficult (impossible for modern supercomputers to do in a reasonable amount of time) to reverse for another party that might have been listening in on them. Alice and Bob now use this common secret to encrypt and decrypt their sent and received data. Note that the yellow paint is already agreed by Alice and Bob:
Here is an explanation which includes the encryption's mathematics:
The simplest, and original, implementation of the protocol uses the multiplicative group of integers modulo p, where p is prime and g is primitive root mod p. Here is an example of the protocol, with non-secret values in blue, and secret values in boldface red:
|
- Alice and Bob agree to use a prime number p=23 and base g=5.
- Alice chooses a secret integer a=6, then sends Bob A = ga mod p
- A = 56 mod 23
- A = 15,625 mod 23
- A = 8
- Bob chooses a secret integer b=15, then sends Alice B = gb mod p
- B = 515 mod 23
- B = 30,517,578,125 mod 23
- B = 19
- Alice computes s = B a mod p
- s = 196 mod 23
- s = 47,045,881 mod 23
- s = 2
- Bob computes s = A b mod p
- s = 815 mod 23
- s = 35,184,372,088,832 mod 23
- s = 2
- Alice and Bob now share a secret: s = 2. This is because 6*15 is the same as 15*6. So somebody who had known both these private integers might also have calculated s as follows:
- s = 56*15 mod 23
- s = 515*6 mod 23
- s = 590 mod 23
- s = 807,793,566,946,316,088,741,610,050,849,573,099,185,363,389,551,639,556,884,765,625 mod 23
- s = 2
Both Alice and Bob have arrived at the same value, because (ga)b and (gb)a are equal mod p. Note that only a, b and gab = gba mod p are kept secret. All the other values – p, g, ga mod p, and gb mod p – are sent in the clear. Once Alice and Bob compute the shared secret they can use it as an encryption key, known only to them, for sending messages across the same open communications channel. Of course, much larger values of a, b, and p would be needed to make this example secure, since it is easy to try all the possible values of gab mod 23. There are only 23 possible integers as the result of mod 23. If p were a prime of at least 300 digits, and a and b were at least 100 digits long, then even the best algorithms known today could not find a given only g, p, gb mod p and ga mod p, even using all of mankind's computing power. The problem is known as the discrete logarithm problem. Note that g need not be large at all, and in practice is usually either 2, 3 or 5.
Here's a more general description of the protocol:
- Alice and Bob agree on a finite cyclic group G and a generating element g in G. (This is usually done long before the rest of the protocol; g is assumed to be known by all attackers.) We will write the group G multiplicatively.
- Alice picks a random natural number a and sends ga to Bob.
- Bob picks a random natural number b and sends gb to Alice.
- Alice computes (gb)a.
- Bob computes (ga)b.
Both Alice and Bob are now in possession of the group element gab, which can serve as the shared secret key. The values of (gb)a and (ga)b are the same because groups are power associative. (See also exponentiation.)
In order to decrypt a message m, sent as mgab, Bob (or Alice) must first compute (gab)-1, as follows:
Bob knows |G|, b, and ga. A result from group theory establishes that from the construction of G, x|G| = 1 for all x in G.
Bob then calculates (ga)|G|-b = ga(|G|-b) = ga|G|-ab = ga|G|g-ab = (g|G|)ag-ab=1ag-ab=g-ab=(gab)-1.
When Alice sends Bob the encrypted message, mgab, Bob applies (gab)-1 and recovers mgab(gab)-1 = m(1) = m.
Read more about this topic: Diffie–Hellman Key Exchange
Famous quotes containing the word description:
“Whose are the truly labored sentences? From the weak and flimsy periods of the politician and literary man, we are glad to turn even to the description of work, the simple record of the months labor in the farmers almanac, to restore our tone and spirits.”
—Henry David Thoreau (18171862)
“The next Augustan age will dawn on the other side of the Atlantic. There will, perhaps, be a Thucydides at Boston, a Xenophon at New York, and, in time, a Virgil at Mexico, and a Newton at Peru. At last, some curious traveller from Lima will visit England and give a description of the ruins of St. Pauls, like the editions of Balbec and Palmyra.”
—Horace Walpole (17171797)
“The next Augustan age will dawn on the other side of the Atlantic. There will, perhaps, be a Thucydides at Boston, a Xenophon at New York, and, in time, a Virgil at Mexico, and a Newton at Peru. At last, some curious traveller from Lima will visit England and give a description of the ruins of St Pauls, like the editions of Balbec and Palmyra.”
—Horace Walpole (17171797)