This is a command-line dice game where two players (you and the computer) each select a custom die (with 6 faces), roll it using a fair HMAC-based number generation method, and compare results to determine the winner.
Run the game with dice sets as arguments:
node start.js 2,2,4,4,9,9 6,8,1,1,8,6 7,5,3,7,5,3
All random values are generated before user input and committed with HMACs using a secret key. After user input, the key is revealed for verification.
You can verify:
HMAC = HMAC_SHA3-256(secretKey, number)
- Ensures the game can’t cheat by changing numbers after seeing your input.