G™Cryptographic Rock-Paper-Scissors

A perennial problem on the internet in text chat is that a naively implemented Rock-Paper-Scissors game leads to whoever plays a move first winning, as the winning move given the other player's move is known and fixed. Cryptography solves this: it is possible for each player to commit to a move before revealing it.

Protocol

Each player selects their move and a random salt. They then transmit the hash of the move and salt to the other player. Once both players have received the other's hash, both reveal their move and salt. As long as it is impractical to generate hash collisions and the salts are sufficiently high-entropy, the hash constrains each player such that they cannot choose another one but does not reveal the move they made.