Shared secret key exchange with colors

Alice and Bob want to exchange secret messages with one another over a public network. To keep their communication private, they'll encrypt these messages with a shared secret, which is a secret piece of information that only the two of them know. But how do two people who can only communicate over a public network decide on a shared secret without exposing that secret to others on the network?

When trying to understand modern key exchange methods, it's helpful to use a paint color analogy. It's easy for humans to mix two different paints together to get a new color. However, given a paint that's already been mixed together, it's a lot harder to find out what exact colors were used to create that mixed color. Alice and Bob can take advantage of this to create a secret paint color (which can be used as a secret key) that both of them know without ever communicating that color to each other.

To create their secret key, Alice and Bob must first choose their own private colors, which they won't share with anyone else. They can use any colors they like as long as they keep those colors secret. They also have to decide on a public color, which they'll do over the public network. It's okay if other people know the public color.

Use the paint buckets below to choose separate private colors for Alice and Bob, and a third color that they'll use as their public color.

Stage one - mixing publicly traded colors

First, Alice mixes her private color with the public color. She sends this resulting color to Bob over the public network.

¼
¼
¼
¼
Alice's private color
Public color
Mix colors in the beaker to see Alice's public mix

Bob also mixes his private color with the public color. He trades the result with Alice over the public network.

¼
¼
¼
¼
Bob's private color
Public color
Mix colors in the beaker to see Bob's public mix

Stage two - creating the secret key

Alice combines the mixed color she received from Bob with her private color to create their secret key.

¼
¼
¼
¼
Bob's public mix
Alice's private color
Mix colors in the beaker to see the Secret key color

Bob does the same with Alice's mixed color and his private color. Though he never received Alice's private color, he gets the same secret key.

¼
¼
¼
¼
Alice's public mix
Bob's private color
Mix colors in the beaker to see the Secret key color

Eve, who is watching the public network, has only seen the following colors. Can she find the secret key?

Alice's public mix
Bob's public mix
Public color

You can test your theory by playing the color mixing game and seeing how easy or difficult it is to figure out the private colors when you know the public colors.

Play the color mixing game