2

enter image description here

I understand the diagram up till the point where Bob and Alice do a "Public transport" of their respective mixture. I am wondering how do Bob and Alice know what secret colour to add ( circled picture ) to get the Common secret

3

The best way to understand the realms of Diffie–Hellman key exchange is to throw a glance on the mathematical procedures ut follows and which I am going to explain:

  1. Alice & Bob agree PUBLICLY to share a random INTEGER number p that belongs to a the cyclic group g of the ring (Z/pZ)*.
  2. Alice & Bob choose RANDOM integer numbers (a and b respectively; {a,b} belong to (Z/pZ)*)
  3. Alice sends (g) pow a (mod p) to Bob
  4. Bob sends (g) pow b (mod p) to Alice
  5. Alice computes enter image description here
  6. Bob computes enter image description here
  7. The shared secret is then enter image description here

But where is the answer to your question ? It is highlighted by the second step of the algorithm: it means Bob & Alice have not to know how to choose the circled pictures but they choose them randomly.

3

I think the diagram explains it quite well, but I'll give a step-by-step explanation:

  1. Alice and Bob both select a common random colour. In your diagram, that's yellow.
  2. They both select random secret colours (orange and green, respectively).
  3. They each mix their random colour with the common colour. Assume that splitting the colours back out into the exact original components is very hard.
  4. They send each other their mixed colour. These are publicly visible, but as separation is difficult an attacker would find it very hard to work out which random colours Alice and Bob picked.
  5. Alice and Bob both mix the colour they received with their own secret colour. If you follow the path of each colour, you'll see that the left-hand path is yellow + orange + green, and the right hand path is yellow + green + orange. These both sum to the same shade of greenish-brown, resulting in an identical shared secret between the two people.

This is a really nice parallel to how the maths works:

  1. Alice and Bob both select a common random number p which is publicly shared (with some special properties). They also share a common base value g, which is not depicted in your diagram explicitly.
  2. Alice and Bob both select a private random number each, which we'll call a and b.
  3. Alice and Bob combine the public common number p with their own secret a and b values, by computing ga mod p and gb mod p respectively. Computing a or b back from the results is a computationally difficult task.
  4. They share their computed values with each other.
  5. Alice computes (gb)a mod p from her secret value a and Bob's exchanged value gb mod p. Bob computes (ga)b mod p from his secret value b and Alice's exchanged value ga mod p. By rule, any value of the form (xy)z is equal to xyz. This means that Alice has (gba) mod p and Bob has (gab) mod p, which are identical numbers. These identical numbers form a shared secret.
1

If you just want to understand the concept and not the math, which is fine, I would like to give you a semi-mathematical explanation, but in fact your model with the colors is rly confusing for me:

Imagine Alice and Bob agree on any number random number g. Lets say g = 5. Now each of them choses a secret number. Alices chooses a = 2 and Bob chooses b = 3. The public numbers are calculated by A = g^a = 5^2 = 25 for Alice and B = g^b = 5^3 = 125 for Bob. Now, as Alice knows B = 125 and Bob knows A = 25, as those are the public numbers. They both pow this number by their private numbers and Alice gets B^a = 125^2 = 15625 and Bob gets A^b = 25^3 = 15625. So 15625 is the shared number.

In fact we need some more restrictions to have a save exchange, wikipedia offers a good explanation, as begueradj does.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.