Bob and Alice Are Now Rich, But Who Has Most Money?

--

With all the security breaches going around, Bob and Alice are now wealthy but have fallen out. In fact, they don’t trust each other anymore and don’t even trust Trent to audit their accounts. So how can Bob and Alice compare their wealth, and find out who has more, without them knowing how wealthy each of them is? This is known as the millionaire’s problem and is well-known as a problem in processing things without any trusted third party.

In this case, we will split their well into $1 million (00), $2 million (01), $3 million (10), and $4 billion (11). We can then create a K-map for “greater than” and “equal to”:

The logic then becomes:

This logic is then implemented in Python as:

g = c_bit_a_0*inv(c_bit_b_1)*inv(c_bit_b_0) + c_bit_a_1*inv(c_bit_b_1) \
+ c_bit_a_1*c_bit_a_0*inv(c_bit_b_0)
e = inv(c_bit_a_1)*inv(c_bit_a_0)*inv(c_bit_b_1)*inv(c_bit_b_0)+ \
inv(c_bit_a_1)*(c_bit_a_0)*inv(c_bit_b_1)*c_bit_b_0+ \…

--

--

Prof Bill Buchanan OBE FRSE
ASecuritySite: When Bob Met Alice

Professor of Cryptography. Serial innovator. Believer in fairness, justice & freedom. Based in Edinburgh. Old World Breaker. New World Creator. Building trust.