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:
(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.)
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 |
55a3e22a7ec1926f0bf9c112ba3c9379 74512e36051e5afaf0ac65ea160d798b bdf9ff65c5739f743c01ded88f3783b2 ff93e03fed1c1193bb0496e12ed76117Thus, the order is Jeff, Suzy, Thor, Ellen.
(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.