Alice and Bob should be able to send each other proof that they have chosen a number before they show which number they have chosen. Then, the number they chose should be checked against the evidence. Finally, both numbers must be combined in some way, which will not give each of them full control over the result.
The following crypto_function may be something like sha1sum or md5sum :
Step 1 :
to make the range of possible values โโfor crypto_function below large enough
- Alice picks the random numbers
Ra1 and Ra2 and sends Ra1 to Bob. - Bob picks the random numbers
Rb1 and Rb2 and sends Rb1 Alice.
Step 2 :
creates evidence of Hx that the value of Vx now corrected, but does not allow deriving this value from this proof
- Alice chooses the value
Va (0 <= Va <= 5), composes the line Sa="Va Ra2 Rb1" and sends Ha=crypto_hash(Sa) to Bob. - Bob selects the value of
Vb (0 <= Vb <= 5), creates the string Sb="Vb Rb2 Ra1" and sends Hb=crypto_hash(Sb) Alice.
Step 3 :
generates the desired result V
- Alice sends
Sa Bob. Bob computes Ha from Sa and compares it with Ha from step 2. Then he takes Va from Sa and calculates the value V=(Va+Vb)%6+1 . - Bob sends
Sb Alice. Alice Calculate Hb from Sb and compare it with Hb from step 2. Then select Vb from Sb and calculate the value V=(Vb+Va)%6+1 .
Update
Based on the Coin Transfer by Phone , the @ Moron algorithm suggested could be:
Bob picks the random number R and the value 0 <= Vb <= 5 , Calculates the hash H=crypto_hash("Vb R") and sends it to Alice.
Alice selects the value 0 <= Va <= 5 and sends it to Bob.
Bob sends Vb and R Alice; Bob computes V=(Va+Vb)%6+1
Alice checks H=crypto_hash("Vb R") ; Alice calculates V=(Va+Vb)%6+1
... Although I would feel better if:
0. Alice picks a random number Q and sends it to Bob.
And the line to be hashed then becomes "Vb QR" .
Chen levy
source share