The Plank Random Choosing Algorithm


The goal of this algorithm is as follows:

You have n players that you want to order randomly for a game. Obviously, everyone can roll dice or flip coins to do this, but suppose that you are physically distributed, and you don't trust one player to roll dice for others (or select a random number seed, etc).

Your goal is to do the random ordering in such a way that everyone can influence it, but no one can be malicious about it and affect the ordering in an intentional way.

Here's my algorithm. I'm sure there are other, better algorithms to do this, but this is the one I came up with:

The idea here is that since every player chooses a word, every player has an influence on the result. However, since you don't know the other player's words when select your word, and since the other words affect your phrase arbitrarily, neither you nor the other players can intentionally affect the end result.

(You may ask how the players can communicate their words in such a way that the word choosing is truly independent. More on that below.)


Example

Let's suppose that Thor, Suzy, Jeff and Ellen are choosing. They choose the following phrases: Here's a table of the various values:

i pi wi ci mi
0 Thor "Indeed" "IndeedFamilyGamblingTherapy" bdf9ff65c5739f743c01ded88f3783b2
1 Suzy "Family" "FamilyGamblingTherapyIndeed" 74512e36051e5afaf0ac65ea160d798b
2 Jeff "Gambling" "GamblingTherapyIndeedFamily" 55a3e22a7ec1926f0bf9c112ba3c9379
3 Ellen "Therapy" "TherapyIndeedFamilyGambling" ff93e03fed1c1193bb0496e12ed76117
The order of the MD5 hashes is:
55a3e22a7ec1926f0bf9c112ba3c9379 
74512e36051e5afaf0ac65ea160d798b 
bdf9ff65c5739f743c01ded88f3783b2 
ff93e03fed1c1193bb0496e12ed76117 
Thus, the order is Jeff, Suzy, Thor, Ellen.

Code

Implemented in choosing.cpp.

If you don't trust the independent phrase selection

Everyone chooses a phrase and does not share it. Instead, they share the MD5 hashes of their phrases. After the MD5 hashes have been broadcast to everyone, then the players share their phrases. In that way, you can verify that the phrases match the hashes, and players can't change their phrases after they have seen the other phrases.

(The only way that a player could change his/her value, while maintaining the same hash, would be to perform a second preimage attack.) Although it's difficult with MD5 (see the Wikipedia article on hash function security), it is theoretically plausible, so go ahead and use a better hash function like SHA256.