yusuftok516.com my scratchpad

How to Share a Secret in a Crowded Room (Using Paint)

3 mar 2026

Have you ever needed to share a secret with a friend across a crowded room, but you couldn't just walk over and whisper it?

Imagine we’re in the same classroom. I’m at one end, you’re at the other, and you really need my laptop password. I want to give it to you, but there are other people around and I definitely don't want them hearing it. Since we’re too far apart to whisper, how do we do it?



The "Classical Math" Attempt (And Why It Fails)

You might think, "Let's just use a quick code!"

Let's say my password is 601030. I could shout across the room: "Hey! If you multiply my password by 47, you get 28248410!" You’re smart, so you just divide that big number by 47 and boom—you have my password.

But here is the problem: the other people in the classroom aren't stupid either. If they heard me say "multiply by 47," they can just do the exact same reverse math and steal my password.

We need a completely different method to generate a "secret key." We need a way where we both end up with the same key, but absolutely no one listening in can figure it out.




The Long-Distance Dilemma

You might be thinking, "Why don't you just meet up in the hallway beforehand and agree on a secret rule, like 'multiply by 8 and add 450'?" That works if we are physically in the same place. But what if we can't meet up? What if you are in Istanbul and I am in Trabzon? We can't just lean over and whisper a secret key to each other over the internet without someone potentially snooping.

We need a mathematical trick. But since math can get boring, let's explain it using colors!




The Magic of Mixing Colors

We can create a shared secret key without ever meeting face-to-face. Here is how we do it:


Step 1: The Public Color

First, we shout across the room (or send a public message) and agree on a starting color. Let's say our public color is Green. Everyone in the room knows the starting color is Green.



Step 2: The Secret Colors

Now, I secretly choose a color just for myself—let's say Pink—and I don't tell anyone. You also choose a secret color for yourself—let's go with Navy Blue—and you keep it totally hidden.



Step 3: The First Mix

I take my secret Pink and mix it with the public Green. You take your secret Navy Blue and mix it with the public Green.



Step 4: The Swap

Now, we exchange our mixtures out in the open! I hand you my Pink-Green mix, and you hand me your Navy-Green mix.



Step 5: The Final Reveal

Here is where the magic happens. I take the mixture you gave me (Navy + Green) and add my secret Pink to it. You take the mixture I gave you (Pink + Green) and add your secret Navy Blue to it.


Look at our paint buckets! We both ended up with the exact same 3-color mixture: Pink + Green + Navy Blue.

But what did the eavesdroppers in the classroom see?

• They saw the starting Green.

• They saw me hand you a lighter mixed color.

• They saw you hand me a darker mixed color.

Because they never knew our original secret colors (Pink and Navy Blue), they are always missing at least one ingredient. They can't figure out how to recreate our final, perfect 3-color blend.

And just like that, without ever whispering or meeting in private, we created a shared secret key that only the two of us know!