Bitcoin Forum
May 04, 2024, 08:59:46 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Secure Poker  (Read 719 times)
CasinoBit (OP)
Sr. Member
****
Offline Offline

Activity: 364
Merit: 250



View Profile
June 07, 2013, 03:06:09 PM
 #1

What would be the most secure method to shuffle the card deck? I was thinking of letting every player generate a cryptographically secure string locally (and the ability to edit it manually, of course), I was thinking 32 characters per player should be plenty and then pack the string with SHA256 and move to the right every time a new source of entropy is needed. Of course then if the server is sabotaged one could potentially know the results ahead of time, even though one could also see all the players cards in that theoretical situation aswell so there is really no point in doing this every time a card is drawn is there?
1714813186
Hero Member
*
Offline Offline

Posts: 1714813186

View Profile Personal Message (Offline)

Ignore
1714813186
Reply with quote  #2

1714813186
Report to moderator
"Governments are good at cutting off the heads of a centrally controlled networks like Napster, but pure P2P networks like Gnutella and Tor seem to be holding their own." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
Kazimir
Legendary
*
Offline Offline

Activity: 1176
Merit: 1001



View Profile
June 07, 2013, 03:46:47 PM
 #2

1. Let every player submit a custom 'seed' string (random gibberish), and for convenience offer the option of just having one randomly generated. Also, the server generates a random seed string.

2. The Sha256 hashes of these seed strings are displayed in advance, so everybody can be certain the results were not manipulated afterwards.

3. Concatenate all these seed strings in a deterministic order (e.g. alphabetic) and take the Sha256 hash of the result.

4. Generate a deck of cards from this Sha256 hash, to have a semi-random (deterministic but unpredictable and uniformly distributed) shuffled deck of cards.

As for how to implement step 4: use some big integer math, and interpret the Sha256 hash from step 3 as one big integer number. Take this number modulo 52 to pick the first card, and divide the number by 52. Take the resulting number modulo 51 to pick the second card, and divide the number by 51. Et cetera.


In theory, there's no difference between theory and practice. In practice, there is.
Insert coin(s): 1KazimirL9MNcnFnoosGrEkmMsbYLxPPob
Pages: [1]
  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!