You want to send a secret message to your friend Alex in the mail.
But Sam, who you don't trust, has access to all your mail.
So you put your message in a box with a lock.
But you can't send a key, because Sam could use or copy it!
How can you get your message through securely?

Note: Alex doesn't have a key to your lock.


2 Answers 2


Here is how

You send the locked message (without the key) to Alex.
Alex puts an extra lock on the message (Alex has the key to that extra lock).
Alex sends the double locked message (without any key) back to you.
You remove your lock, and send the message back to Alex.
Alex removes the lock that he put on.

  • $\begingroup$ Except that Sam intercepts the box, sends it back with his own lock, and then intercepts the box with Alex's lock removed. $\endgroup$
    – Florian F
    Jul 26, 2020 at 13:14
  • $\begingroup$ @FlorianF Maybe change it to rot13? $\endgroup$ Jul 26, 2020 at 13:16
  • $\begingroup$ As soon as this site provides a way to encode and decode it. $\endgroup$
    – Florian F
    Jul 26, 2020 at 13:20
  • $\begingroup$ @FlorianF Good point. $\endgroup$ Jul 26, 2020 at 13:20
  • $\begingroup$ @FlorianF Do you have your own encoder? (just curious) $\endgroup$ Jul 26, 2020 at 13:21

This is a very famous problem. Not sure if it’s been posted here before however.

The solution involves

Sending it back and forth three times.

This way

You send the message to Alex with your lock. Alex attaches his own lock and returns it. You remove your lock, so the box only has Alex’s lock on it, send it back to him, and he can unlock it and see your message. This way the message always has a lock on it.


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