Shuffle and deal a deck with no trusted dealer: no player sees where any card is, and a card is opened only for the player it is dealt to. The scheme is SRA commutative encryption on an elliptic-curve group.
- Encode. Card
iis the first curve point whosexisi | nonce << 8. Nobody knows a multiplier between two cards, which the scheme needs: a player who knewcard1 = k·card0could findcard1in any locked deck oncecard0is opened. - Lock and shuffle. Each player, in turn, multiplies every card by a secret
sand permutes the deck. Locks commute:a·(b·C) = b·(a·C). - Open. To open a card for a player, every other player multiplies it by their
s⁻¹ mod nand hands it on; the player removes the last lock alone and finds the card in the plain deck. A card that still holds a lock is not in the plain deck, soopenrefuses it.
mentalPoker(curve)—{ deck, key, open }over a curve:deck(size)— the plain deck,sizein0..0x100, ornull.key(secret)—{ lock, unlock },secretin1..n-1, ornull.open(deck)(card)— the card's index in the plain deck, ornull.
shuffle(seed)(list)— the permutationseedspells in the factorial number system.lockAndShuffle(key)(seed)(deck)— one player's turn.unlockAll(keys)(card)— remove several players' locks.
Players are trusted to lock, shuffle and unlock honestly, and a player who leaves stalls the game. Proofs of a correct shuffle and unlock, the message protocol between players, and dropouts are the open tasks of ../todo/mental-poker.md.