Fairplay: Secure Two-Party Computation

An extremely simplified version of the Millionaire's Problem. Alice and Bob are the millionaires, and they each have just 1-bit inputs. The expected behavior of the circuit is given in the truth table.

Truth Table
Alice Bob Alice's Output Bob's Output
0 0 0 0
0 1 0 1
1 0 1 0
1 1 0 0

Gates


Gate 1
x, Wire 1 z, Wire 3
eggs.. cat...
bacon. dog...
Gate 2
x, Wire 2 z, Wire 4
apple. hotdog
banana burger
Gate 3
x, Wire 1 y, Wire 4 z, Alice Output
eggs.. burger 0.....
eggs.. hotdog 0.....
bacon. burger 0.....
bacon. hotdog 1.....
Gate 4
x, Wire 3 y, Wire 2 z, Bob Output
dog... apple. obama.
dog... banana obama.
cat... apple. obama.
cat... banana biden.
Gate 1
x, Wire 1 z, Wire 3
0 1
1 0
Gate 2
x, Wire 2 z, Wire 4
0 1
1 0
Gate 3
x, Wire 1 y, Wire 4 z, Alice Output
0 0 0
0 1 0
1 0 0
1 1 1
Gate 4
x, Wire 3 y, Wire 2 z, Bob Output
0 0 0
0 1 0
1 0 0
1 1 1

Hasher

Concatenates the inputs, then computes the SHA1 hash.

Gate Number:

x:

y (optional):


Result:

Decrypt

Attempts decryption by taking the exclusive-or of the supplied hash and hex-encoded ciphertext.

xor
Result (ASCII):

Encrypt

Encrypts by taking the exclusive-or of the supplied hash and plaintext.
Not used for the activity, but included for completeness.

xor
Result (Hex-Encoded):
SHA1 implementation by crypto-js