I decided to ask the question here, because although the problem is mathematical, I'm interested in its application here. In the version i read in wikipedia, they suggested the following method for Alice and Bob to agree on a coin flip result from afar:
1)Alice gives Bob a commitment(a box), which contains her 'call', but Bob dosent know what it is.
2)Bob performs the flip and reports the result to Alice.
3)Alice tells the 'key' to Bob who now learns her 'call'. If the call matches the report, Alice wins, else Bob does.
First of all, I want to know how this 'box' is actually implemented, in a relevant crypto system. Based on how the 'box' is actually defined, Alice can always win as follows: (We assume a 'box' to be a secure file, whose contents are absolutely unknown to Bob. Name this file F)
1)Alice gives Bob the 'box' which contains both possible calls 'tail' and 'heads' of the coin flip(but obviously Bob dosent know anything about the contents by the definition used above).
2)Bob performs the flip and reports the result to Alice(let it be heads).
3)Alice supplies the corresponding key $k_h$ to Bob, such that: $k_h(F) = 'heads'$, and alice inevitably wins.(if Bob reported tails, she would supply $k_t$ such that $k_t(F) = 'tails'$)
Basically the file here is a 2-key container, which returns a different result based on the key used. Is the definition of 'box' i gave wrong? What is the correct definition?