As recent as 2010 we were finding major flaws in online poker security, here are a couple of videos I did of us sniffing hole cards out of the air because sites were lying about their use of SSL. They were using xOR encryption. Insane.<p><a href="http://www.youtube.com/watch?v=4HBUe8Fb73Q" rel="nofollow">http://www.youtube.com/watch?v=4HBUe8Fb73Q</a>
<a href="http://www.youtube.com/watch?v=AAQDEXJdbQc" rel="nofollow">http://www.youtube.com/watch?v=AAQDEXJdbQc</a>
The solution here, which the article fails to mention, and which every security expert will undoubtedly tell you, is to make sure you use <i>super random numbers</i> (that's the technical term, for the layperson) by adding two random numbers together.
I understand that "swap with entire deck" can't possibly be uniform because it has 52^n input possibilities, which is not divisible by 52! (and that the correct Fisher-Yates having 52! input possibilities and being able to generate every possible outcome is one way to prove that it is uniform). However, I'm not sure I can come up with an intuition for why any particular bias should exist, or why there is a discontinuity that makes it much more likely for a card to end up a short distance after its starting position:<p><a href="http://en.wikipedia.org/wiki/File:Orderbias.png" rel="nofollow">http://en.wikipedia.org/wiki/File:Orderbias.png</a><p>Anyone have a good explanation?
It seems to me that the only major issue here is using a seed which can be trivially brute forced. Even if you don't look around the expected server time in order to guess the seed more quickly, 32 bits is really not hard at all to brute force these days.<p>I don't believe the number of bits the PRNG can generate is an issue here since we only need to uniformly get a number between 1 and 52, though what may be questionable is the cycle length of the PRNG if it weren't using an easily brute forced seed.<p>I'm not entirely convinced the off-by-1 is substantial, nor the fact that the shuffle produces duplicate shuffles (I can't intuit a significant bias, so I may well be wrong here).<p>So to summarize: never seed a PRNG with a small and easily brute forced value.
Direct link to the full article with a detailed explanation of the exploit: <a href="http://www.cigital.com/papers/download/developer_gambling.php" rel="nofollow">http://www.cigital.com/papers/download/developer_gambling.ph...</a>
Ignoring that some of the variables don't match up properly (the arrays: card and Card), it seems like the explanation of the first flaw may also be flawed.<p><i>Flaw #1: An Off-by-One Error<p>The algorithm above tries to iterate over each card in the deck, swapping each card with another randomly chosen card in the deck. However—every programmer has made this mistake before—there's an off-by-one error. The function random(n) returns a number between 0 and (n-1), not between 1 and n as the programmer intends. As a result, the algorithm will never swap the 52nd card with itself; the 52nd card can never end up in the 52nd place. So that is the first reason the "random" card shuffling isn't really random.</i><p>The comment refers to the Pascal code:<p><pre><code> random_number := random(51)+1;
</code></pre>
If the programmer really thought that random was between 1 and n then the random_number variable would be a number between 2 and 52 (1+1 to 51+1). It seems like, instead, a better explanation is that they may have thought random(n) produced a random number between 0 and n, hence the need to increment by one. Another explanation is they just messed up the slicing using 51 instead of 52.<p>The point being that in the writer's explanation of the flaw they actually make the same mistake.<p>Funnily enough googling "pascal random" points to a stackoverflow article where the best answer makes the same error.<p><a href="https://stackoverflow.com/questions/4965863/how-to-get-a-random-number-in-pascal" rel="nofollow">https://stackoverflow.com/questions/4965863/how-to-get-a-ran...</a>
This was an interesting article. (Font size is tiny using Chrome on iOS).<p>> If your business or technology depends on using random numbers, your best bet is to use a hardware random number generator.<p>Some hardware RNGs would be hopeless for this task. It'd be scary to have to buy one of these things and trust the output.
I haven't seen this link posted yet
<a href="http://www.idquantique.com/random-number-generators/products.html" rel="nofollow">http://www.idquantique.com/random-number-generators/products...</a><p>Note they claim: "QUANTIS has also been approved by national authorities and can be used for gaming applications."<p>If I were implementing this for a casino, I'd do what other posters have already suggested and use at least two independent hardware sources for my random numbers and XOR them together. IMO Intel's on-chip RNG would probably be a good source to use, but only in conjunction with others.
I'm curious how actually random are current generators in online poker? I mean, some rather subtle patterns, situations would generate larger pots, therefore more rake. Or being on the new players side in 50/50 situations would 'help' to get him addicted.<p>I am not talking about 100% of the time dealing someone pocket kings, and someone else pocket aces and king on the flop.<p>Something subtle and very rare would be enough to count for large amounts of money at the end of the year, given the volume of major poker sites. On other hand, if someone would leak it, that might ruin the business for good.
Flaw #3 seems flawed to me. There are 52! possible ways to shuffle a deck of cards but a game is only played using a small subset. Suppose there are 4 players, then you need 2 times 4 plus 5 is 13 cards. The remaining deck of 39 cards can be shuffled in 39! ways without affecting the game. These possibilities are still included in those 52! of total possibilities. In case of 4 players there are only 52!/39! possible games that can be played. This is still a larger number then the 4 billion mentioned in the article but it doesn't dwarf the 4 billion as the 8*10^67 does.
I admit I am a total noob here, but couldn't you make something with a TV turned to a station with just static? I have often wondered about this but lack the 'propriate schoolin'.
I'm not a pro (not even an amateur, actually), but the very premise of “shuffling the deck” bewilders me. Shuffling the whole deck is so obviously bug-prone. Why not just pick random elements from decks instead? If I ever wrote a deck simulator I'd never shuffle anything, just picked 1 out of n < 52 when needed. Is this approach too naive and well-known to be somehow flawed as well?
Another lesson to be learned here is it's generally not a good idea to publish the code to a vulnerable, in-production system unless you are very, very sure there are no bugs.
I like to use this as an example of a problem that secure multiparty computation can solve i.e. that you can remove a buggy / malicious central dealer from a system.