Secure Coin Tossing
By David Phillips
June 4, 2009
We have two (very bored) people named Alice and Bob who are in geographically different places and talking to each other on the phone.
They decide to amuse themselves by playing
a coin flipping game where one of them flips a coin and the other guesses which
side of the coin lands it lands on. Alice decides to flip the coin first and
does so. Bob makes his choice of “heads”
or “tails”.

This system works great when everybody is honest.
What if
We need a system that ensures fairness such that nobody can cheat. We can solve this problem using cryptographic primitives in the following ways:
Solution 1)
C = E(S, K)
Where E is some encryption algorithm and C is the cipher text produced by encrypting s with the key K.
Bob chooses string G from the set {“HEADS”, “TAILS”}
and sends it to
Bob decrypts C using K as follows:
S = D(C,K)
Where D is some decryption algorithm and C is the cipher text produced by encrypting S with the key K.
Bob compares S (Alice's decrypted commiteed result) to G (Bob's guess) to confirm whether or not he won the coin toss.
Solution
2 BAD)
C = E(R, K)
Where E is some encryption algorithm and C is the cipher text produced by encrypting R with the key K.
Bob guesses G as “even” or “odd” and
sends it to
Bob decrypts C using K as follows:
R = D(C,K)
Where D is some decryption algorithm and C is the cipher text produced by encrypting R with the key K.
Bob compares R to G to confirm whether or not he won the coin toss.
E(e, K1) = C
E(o,
Where E is some encryption algorithm
and C is the cipher text produced by
encrypting e,
o with one of the keys K1,
Bob guesses G as “even” or “odd” and
sends it to
If G is “even”, then
If G is “odd”, then
Solution 3)
h = H(r)
Where h is the hash value produced by hashing algorithm H with input r.
Bob guesses
G as “even” or “odd” and sends it to
Bob hashes r and verifies that the result matches h as follows:
h” = H(r)
assert(h” = = h)
The reason
The advantage of using the hashing scheme is that it is very difficult to find two
input values that map to the same hash value as hash functions are designed to be
collision resistant. In order for