19
$\begingroup$

5 people are standing in a circle - person A needs to tell his salary to person B, but none of the others should know A's salary.

How is this possible, if every person only whispers to the person on the right and B does not stand to the immediate right of A?

$\endgroup$
2
  • 3
    $\begingroup$ It can be possible if $B$ stands on the right from $A$ :) So, please clarify the puzzle. $\endgroup$
    – trolley813
    Apr 19, 2019 at 7:45
  • $\begingroup$ Thank you for pointing that I have edited the puzzle accordingly $\endgroup$
    – ace
    Apr 19, 2019 at 7:49

9 Answers 9

16
$\begingroup$

How about this:

A whispers a random number, when it gets to B, then B adds a different random number and whispers along the circle. When it gets back to A, calculate the difference between the number sent and the number received. Now A can whisper the sum of A's salary and the secret number.
So the people on one side of A know number x.
The people on the other side of A know number z = x + y but neither x nor y.
The people on the fist side of A know z + s without knowing either z or s.
Only A and B know all of x, y and s (where s is the secret salary).

$\endgroup$
1
17
$\begingroup$

Although many people have given this same general idea, it seems like they have all over-complicated a very simple solution. Assuming the other members of the circle are cooperative, and pass along messages accurately:

All B needs to do is pick any random number and pass it to the right. When A receives it, he subtracts it from his own salary and passes along the new number. When that reaches B he can reconstruct the original. Only A & B know both numbers. People between A and B (to the right of A) know the encoded salary only, people between B and A (to the left of A) know only the code number.

The instructions can be passed quite openly around the circle assuming the other members are cooperative, honest and accurate.

$\endgroup$
7
$\begingroup$

The most simple answer (but it can be unsuitable):

A and B can use public-key cryptography (e.g. with Diffie-Hellman key exchange). The problem becomes even easier because the message (the salary) to send is a number. So, all the messages being whispered will be in the form "Tell A(B) the number 50694, please".

$\endgroup$
3
  • 2
    $\begingroup$ Good solution. But I was looking for more of an addition-subtraction based solution, if any. $\endgroup$
    – ace
    Apr 19, 2019 at 8:53
  • 2
    $\begingroup$ DH kex is only safe against eavesdropping. In this case, the messages in the network can be actively controlled by the adversaries, and since A and B don't have a way to authenticate theirselves to each other, MITM (impersonation) attacks will thwart any attempt of establishing secure communications. $\endgroup$
    – Bass
    Apr 20, 2019 at 11:20
  • $\begingroup$ But the question is only asking for confidentiality.  None of the other answers (except perhaps mine) defend against an attack on integrity. $\endgroup$ Apr 22, 2019 at 2:50
7
$\begingroup$

B starts the conversation with any number B. When it gets to A, A says SA+B, where SA is A's salary. When this gets back to B, B now knows A's salary (and no-one other than A does).

$\endgroup$
2
  • $\begingroup$ How is this different from btw’s answer (aside from the fact that it doesn’t include the irrelevant stipulation that B sits on the left of A)? $\endgroup$ Apr 19, 2019 at 22:29
  • $\begingroup$ @PeregrineRook; that was the major difference, but I've just noticed that B could say any number. $\endgroup$
    – JMP
    Apr 20, 2019 at 3:54
4
$\begingroup$

This can be :)

B sits on the left of A and ask A's salary. And no one know what B ask to A. Then A whispers his own salary to the person on the right. Finally B get's answer! :)

$\endgroup$
4
  • 2
    $\begingroup$ +1 Good thinking outside the box. I can't say more without giving away your answer, but in many ways I think this is the best answer, although not a mathematical one. $\endgroup$ Apr 19, 2019 at 14:34
  • 2
    $\begingroup$ Sounds like security through obscurity. Or am I missing something? $\endgroup$ Apr 19, 2019 at 22:36
  • $\begingroup$ Maybe math calculate every thing. But sometimes we have to think others ways. Thanks for your comment :) @ChrisSunami $\endgroup$ Apr 22, 2019 at 6:02
  • $\begingroup$ Yeah, that's what I thought actually. @PeregrineRook $\endgroup$ Apr 22, 2019 at 6:05
3
$\begingroup$

B sits on the left of A. A asks for B's salary and B whispers his/her salary to A. Then A whispers his own salary+B's salary counter-clockwise. When B hears what A whispered to others, A tells him/her to substract his/her own salary from it.

$\endgroup$
1
  • 1
    $\begingroup$ Nit-pick: the people are standing in a circle.    :-)    ⁠ $\endgroup$ Apr 19, 2019 at 22:28
2
$\begingroup$

And now for something completely different:

A and B both speak a language (for sake of completeness, let’s say Vulcan) that none of the others know.  But the others can repeat Vulcan phonetically.  So A whispers their salary in Vulcan to the person to his right, who relays it (phonetically) to the next person, ….  Eventually it reaches B, who is the only person who can understand it.

$\endgroup$
1
$\begingroup$

I will speculate here a bit. Given that everybody passes exactly what he/she got and does not change anything.

If A knows B's salary, then he can just pass something like it is 700 more than yours
If A and B could communicate before the game started, then they could figure out some function to determine it and pass the numbers. For example: $F(x,y) = x^y + y*x$. So saying 14 and 3 would mean $14^3 + 14*3 = 2744 + 42 = 2786$
They could also use some coder/decoder to pass it if they both know the algorithm that's being used

$\endgroup$
1
$\begingroup$

Try this

B tell his salary to one who sits beside him, and when A receive that, A add that number with his salary, and pass it to one who sits next to him and add a message saying that B have to subtract with his salary. Say B salary is 20K and A was 30K then A tells the person next to him as 50K minus B salary.

$\endgroup$
1
  • 1
    $\begingroup$ How is this different from btw’s answer (aside from the fact that it doesn’t include the irrelevant stipulation that B sits on the left of A)? $\endgroup$ Apr 19, 2019 at 22:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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