0

I was checking this explanation of Diffie-Hellman algorithm using colors.

Alice and Bob want to communicate privately.

  1. A Common Color C is agreed upon by Alice and Bob.
  2. Eve knows about the C because it is communicated over the Network.
  3. Alice mixes her Private Color A to C and sends Alice's Mixture AC over the Network.
  4. Bob mixes his Private Color B to Yellow and sends Bob' Mixture BC over the Network.
  5. Alice and Bob add their own color to the other's mixture BCA = ACB. They arrive at a common, color.

However, I have the following question?

If Eve knows that the common color is C, and Alice's Mixture AC, can't she deduce Alice's secret color using AC - C? At-least in RGB color space, this is easy to calculate right?

In summary, will this algorithm work if the common color C is shared over the network?

PS: I am assuming that volume of the colors is the same as the video doesn't talk about quantity.

Nishant
  • 20,354
  • 18
  • 69
  • 101
  • 1
    No, imagine it like mixing paint. If you add x amount of red paint, and z amount of green paint, how are you going to subtract z amount of green paint when you don't know the initial value of z? – Tallboy Dec 30 '17 at 08:47
  • @Tallboy, You are saying there are other parameters to this i.e `x`, `z` which is the volume of the mixture? I didn't think about that, was assuming the volume is constant. – Nishant Dec 30 '17 at 08:49
  • 2
    Well yes, imagine it like real life. If I give you a color of physical ink.... say... this one: http://randomcolour.com/ -- "please unmix this color" it's a lot more challenging than mixing it. That's mostly what the one way hash function's purpose is, is that its nearly impossible to reverse. – Tallboy Dec 30 '17 at 08:50
  • @Tallboy, The video doesn't talk about it so I assumed we are talking about equal quantities. And, please **unmix this** is a challenge agreed but **I will give you one color that is part of that mixture, please unmix this** is actually trivial right? That is the gist of my original question actually. – Nishant Dec 30 '17 at 08:52
  • 1
    That's mostly just a practical example for beginners I think. The mathematical answer involves modulo, which is summed up in this answer: https://stackoverflow.com/a/2118406/794481 – Tallboy Dec 30 '17 at 08:59

1 Answers1

2

Short answer: Yes, it will work. That is kind of the whole point of this concept.

As for that particular explanation (using paint as an example), it is just that - a simplified example to make the higher level concept understandable.

That higher level concept is in this case, that certain known pieces of data (the known color) can be combined with private / unknown pieces of data (the two "private" colors that are added by Alice and Bob) in such a way that only the intended parties (Alice and Bob) can make use of the resulting product.

In this simplified example, that resulting product is a secret color. In actual cryptography, the result is a secret message of some kind.

The paint is a metaphor. You should not try to over-analyze it. If you are thinking about RGB-codes and volumes of colored liquids, I'm afraid you're missing the point.


Addition/ update: For a slightly more technical description of the Diffie-Hellman exchange, see this answer provided at security.stackexchange.com. As an answer to this current question, I'd like to quote a comment posted below the answer in the link:

I think it's worth mentioning that the reason this is secure is that, unlike normal log(x), the modular log(x) is thought to be hard to compute.

That "hard to compute" part is what is alluded to with the metaphor of paint that is "hard to separate once it is mixed".

Kjartan
  • 18,591
  • 15
  • 71
  • 96
  • Yes, my only question was to get the real principle behind this correctly. The simple color example, which is nice for a beginner like me, also lets me understand that _how_ important it is to get an algorithm that which when we mix something especially with an already known component, it is important that the mixture is not reversible trivially. RGB colors etc won't just be the right idea (because it is reversible), so it helps me try to understand how modulo solves this piece of the puzzle etc. – Nishant Jan 02 '18 at 17:31
  • 1
    @Nishant "*it is important that the mixture is not reversible trivially*" - Exactly. That is the whole point. :) See the link I added if you want a slightly more technical explanation. – Kjartan Jan 03 '18 at 08:40