In the commit-and-reveal scheme, first, a hash of the original secret is submitted to the blockchain. This secret hash is recorded and stored on-chain in the contract. Once all the players or parties have submitted their secret hash, they all have to reveal their choice by submitting salt, using which they have generated the secret hash. A salt is like a password; using this an user can generate a secret hash. This secret is generated by combining the data (to be hidden) and salt and taking hash of this combined data. You can use any hashing algorithm to generate hashes. We have used keccak256 hashing algorithm in the sample code
This way of first committing the secret hash and later revealing it prevents players ...