28 points · by petrosagg · 12y ago · 16 comments
There are several algorithms involving multi-party encryption that actually solve this problem fully. Google for "mental poker" to find more details. There are two classes that are pretty straightforward to talk about. The first involves encryption/decryption that can be done in any order (for instance m -> E1 -> E2 -> D1 -> D2 = m). The first person encrypts the entire deck with the same key, and then shuffles it any way he pleases and sends it to the next person until everyone has encrypted it. Then the second phase is everyone removing their generic key, and applying a specific key for the nth card of the deck. This results in a deck that has been encrypted with unique keys for each slot in the deck. To reveal a card to a player, simply reveal the decryption key for that slot to the players that need to know what it is. This scheme is secure assuming there is a step that verifies that you are being honest when shuffling (it's not trivial to explain how to do this though).
The other way is to generate an encrypted random number corresponding to one of the cards in the deck. To reveal which card it was, just send the decryption keys to the people that need to know it. The other concern is that the same card could be dealt twice, so the trick is to compare the number to all the other numbers to see if they are the same, without decrypting them.
Players would have to commit to their keys ahead of time, however (one approach is to publish a hash of the key). Otherwise, a player can cheat by enumerating keys at random until they find one that causes the deck to decrypt to a more favorable ordering.
The server always knows the state of the deck! Hashing, cutting, etc doesn't matter. In that game of high card, the computer can win in every case but one, when you pick the absolute highest card.
Further, the "fairness" of the shuffle has more to do with the ability to identify (or define) "noise", which is an extremely hard problem mainly because noise is a definition of exclusion. E.g. if a sequence can't mean anything, then we define it to be noise. But how many possible meanings can a string have? I think the technical term is lots, although there are others that involve boldfaced greek letters.
Players have to trust the casino. There is no test a player can do to "verify" a casino is being fair.
(The real attack vector a casino has to worry about is if someone can predict or retrieve the PRNG seed that you used for a particular shuffle, which would be enough for the player to infer the content of the deck - which is what the casino already knows.)
[1] http://en.wikipedia.org/wiki/Mental_poker#Shuffling_cards_us...
> Just in case the Mersenne Twister algorithm has any unknown vulnerabilities
The Mersenne Twister has known vulnerabilities. Seeing 624 iterations of the output is enough to reconstruct all future outputs.
Does this affect their algorithm in practice? I don't know — but just as it's better to lay a building on a strong foundation rather than sand, it's better to design secure protocols with strong cryptographic components with well-tested security features and proofs than to compose multiple weak components and hope for the best.
This protocol also only demonstrates that the casino is "fair", in that it's shuffling decks in an ordering which is not known to the casino ahead of time. This is a far cry from "secure", which would (amongst other things) ensure the casino doesn't even know which card it's dealing until the card has been dealt (ensuring the casino can't collude with other players), and that other players can't predict the next cards with a better probability than random luck.
The site is, surprisingly, still online[1] and now accepting Perfect Money in place of Liberty Reserve. Unfortunately, they seem to still be using MD5 hashes even years later, for example:
TAIL/OaU1ERm1ZbUl5WWpGbE5UTm
bf30359e539686fb3eaa9abf9701938e
>Instead, we compute a seed by combining a server_seed (which is provided in hashed form to the client before the deal - in the same way as the initial_shuffle is) and a client_seed.
What if the server picked a large value and this appending caused an overflow? Don't some languages/runtimes turn an overflow into 0? Then the server could always seed the RNG the same way.
I'm probably very wrong, can someone tell me why?