The Diffie-Hellman Process
I wanted to cover in this post the process of diffie-hellman, related to you in part from wikipedia.org.
The Coolest thing to me is that you can actually use a scientific calculator to work through it using your own numbers. One thing to remember is that this is a simple example. Cisco routers can use DH group 1 (768 bit) DH-2 (1024 bit) and DH-5 (1536 bit).
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. To illustrate we can use the example of Bob and Alice. The process is as follows:
56 mod 23 = 8.
515 mod 23 = 19.
196 mod 23 = 2.
815 mod 23 = 2.
Both Alice and Bob have arrived at the same value, because gab and gba are equal. Note that only a, b and gab = gba are kept secret. All the other values 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 will be, at most, 22 such values, even if a and b are large). 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, 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 or 5.