Skip to content

Instantly share code, notes, and snippets.

@esco
Created August 18, 2014 17:47
Show Gist options
  • Save esco/523f2c89aec552578899 to your computer and use it in GitHub Desktop.
Save esco/523f2c89aec552578899 to your computer and use it in GitHub Desktop.
p2p card game
player1 deck - d1
player2 deck - d2
d1_e == e(ki, d1)
d2_e == e(ki, d2)
p1 <-- d1, d2_e
p2 <-- d2, d1_e
seed - s
shuffle(s, d1)
verify:
shuffle(s, d1_e) == e(shuffle(s, d1))
d1 <-- d1_e[0]
server: regenerate hashes:
server <-- p1 (d1)
server <-- p2 (d1_e)
verify:
d1_e == e(d1)
d1_e = e2(d1)
----------- only verify when a card is revealed
verify when (if not already verified):
summoned
sent to grave
banished
show hand
show card from hand
reveal cards from top of deck
change control
activate set card
play card from hand
verify by sending d1_e[i] and ki to opponent
opponent decrypts d1_e[i] to get card
rehash when:
card sent back to deck
rehash:
p1 --> e(ki, d1_e) --> d1_e2 --> p2
shuffle
new verify
p1 --> [k1, k2], d1_e[0] --> p2
p2 --> d(k2, d1_e2[0]) --> d1_e[0]
p2 --> d1_e[0] exists in old d1_e in same quantity
p2 --> d(k1, d1_e[0]) --> original
map original to d1_e2[0] discared d1_e[0]
rehash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment