Here is the code in PHP:
Here's what I meant about a command line. See the bottom of this page?
https://coinroll.it/bet/fa870f1e518eCommand line verification (bash shell)
echo -n 'b8d60cff5ca2fcd20fbd27987c671a65b32d40ed127c7a4bcaeb251600fc1365:0' | openssl dgst -sha512 -hmac 'WW4hgGFOiVZ0ITgIt89xG2R5OuAiEBTx3FDk2y2oDfJc94JkurVqn2mDwyk9oyr7' | sed 's/^.* //' | cut -c1-4 | xargs -I{} printf "%d\n" 0x{}
Also, it's still not clear how you decide which card is the red one. Is it just whether the random number is even or odd?
Edit: also, I think your scheme is overly complex. All you need to do is:
1) pick 'left' or 'right' at random
2) pick a longish random string
3) concatenate 1) and 2)
4) sha512 hash 3)
5) publish 4) before the game, and 3) after.
No need for hmac, or a 'secret', or even a random number. Just a result (1) and a string to make reversing the hash impossible (2).
Edit2: I wouldn't normally send coins to games with no history or reputation, but I figured it wouldn't be worth your while buying a domain for a 0.0006 BTC scam...
Yes, you can check the value various ways. The point is the value can be verified and can't be changed by the house.
If the last digit of the random number is odd the Red Ace is positioned left, and right if even. Sorry for not adding that in this thread, it's on the
Provably Fair page.
I agree the system can be done differently. The game you see now is slightly different from how it started. The main thing I wanted to achieve was true randomness, so I could even play the game myself. There was a study done by some professor that asked if people had some ability to predict the future. He used a game similar to this and over trials found some people seemed to be able to predict the right choice with slightly better than 50%, and it was a mystery how that happened.
So I take truly random numbers from random.org to ensure randomness and run them through the system.