Post
Topic
Board Gambling
Re: Breaking: Shuffle-based Provably Fair Implementations Can Cheat Players (proof)
by
seuntjie
on 01/06/2016, 14:04:58 UTC
^ I am more curious about above. BitZino allows 32 "aZ09" characters (62^32?) as clientseed and the MT seed is a SHA256 based on that. Isn't that a lot more than 2^32? Maybe I misunderstand that part though.

Good catch, but sadly, the seed maxes out at 232 – 1.

bitZino combines the server seed and client seed, hashes it with SHA256, but then only uses the first 8 bytes of it. So, the range is 0x0 to 0xFFFFFFFF. (FFFFFFFF)16 = (4294967295)10. They write about this in their techblog: https://techblog.bitzino.com/2012-06-30-provably-fair-shuffling-through-cryptography.html
Ah, right. So this seems like a limitation of MT19937. So if they would use MT19937-64, would this be a sufficient solution? This is still less than 52! but at least less feasible to calculate?

Like JackpotRacer I am wondering what "the best solution" would be to get a provably fair random card deck.

I can imagine something like the "dice nonce method" but adding an extra nonce so it could calculate more numbers (since a "duplicate card" cannot happen, so might need to loop a bit more.) But this might get a bit heavy in performance the more unique cards you need Tongue

How about something like this:

PseudoCode:
Code:
list UnshuffledDeck = new list();
//Populate UnshuffledDeck from 1-52, where 1= ace of spades, 2=2 of spades etc etc.
list shuffleddeck = new list(); //empty list

string clientseed = "something"
string serverseed = "randomly generated server seed"
int nonce = 1 //or whatever your nonce should be

while (UnshuffledDeck.count>1)
{
  int tmp = UnshuffledDeck [rng(clientseed,serverseed,nonce,unsuffledeck.count)]
shuffleddeck.add(unshuffledeck[tmp])
shuffleddeck.removeat(tmp);
}
shuffleddeck.add(unshuffleddeck[0])
unshuffleddeck.removeat(0)

function int RNG(string client, string server, int nonce, int max)
{
int randomnumber =  Using a nonce based RNG system similar to Justdice or betking, generate a random number between 0 and 1 000 000.
return randomnumber%max
}

So take a "brand new" deck. Pick 1 card at random from the deck and put it at the top (or bottom) of a new deck. Continue doing this until there are no more cards left n the unruffled deck. The random card picked from the deck depends on the client seed and the nonce of the bet.
If you feel this isn't random enough, repeat the shuffle using the shuffled deck as the new unshuffled deck