Bitcoin Forum
December 14, 2024, 05:36:03 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: Beware bitZino shuffling algorithm leaves much to be desired...  (Read 8655 times)
Cryddit
Legendary
*
Offline Offline

Activity: 924
Merit: 1132


View Profile
May 02, 2016, 06:43:47 PM
 #21

The issue is that his server seed plus your client seed are combined using XOR into a 32-bit shuffle seed.

It doesn't matter who picks what, or whether you know his server seed or whether he knows your client seed.  The issue is that there are only 4 billion possible shuffles.

If you can see five to seven cards, and you know the sequence in which those cards came off the deck, then you know which of those 4 billion shuffles it was.  And therefore what all the other cards (the ones you "can't see") are too. 

This is the fallout from 'Oh crap they can't do math.' 

That is, either they *Really* can't do math, and you can rob them blind because you know what all the face-down cards are - or they're *pretending* they can't do math while they rob all the players blind because they know what all the face-down cards are.

In this case, they came up with a protocol that allows people to 'verify' that the shuffle was "fair" in terms of having both sides pick a seed and having both seeds used in the shuffle.  But 'oh crap they can't do math' because the combined seed was only 32 bits long (4 billion possible shuffles) instead of ~250 bits (same number of possible shuffles as with a real card deck.  The result is that the protocol isn't badly incorrect but because of the implementation it doesn't matter because the game is still unfair.


Dabs
Legendary
*
Offline Offline

Activity: 3416
Merit: 1912


The Concierge of Crypto


View Profile
May 02, 2016, 09:11:37 PM
Last edit: May 02, 2016, 09:23:25 PM by Dabs
 #22

How do you shuffle a deck of cards (52 cards) with 256 bits? I'm thinking a card sort ... (I have a really long method in another thread, but that's not very efficient; it does have the property of being able to reveal only some cards and not the whole deck, which is useful in poker.)

*edit* I did look up the Fisher Yates shuffle, but I'd like to know what others suggest.

Cryddit
Legendary
*
Offline Offline

Activity: 924
Merit: 1132


View Profile
May 02, 2016, 10:40:58 PM
 #23

Standard integer-to-permutation algorithm, applied to large integers.

uint256 Shuffle = rand256();
int deck[52];

for (count = 0; count < 52; count++) deck[count] = count;
for (count = 52; count > 0; count--){
  swap(deck[count-1], deck[Shuffle % count]);
  Shuffle /= count;
}


Pages: « 1 [2]  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!