Hi-lo guide
Sapphire Hi-lo: checking one card draw by hash
Sapphire here is only the page's name, carried over from an earlier version of the site, and it implies no special rules. The page walks through one hash-verified hi-lo draw, line by line, with every value computed in code.
The inputs
In a common construction, three inputs fix each card. The server seed is a secret chosen by the service. The client seed is a string the player can set. The nonce is a counter that goes up by one for each draw. For this example the server seed is sapphire-srv-41c9e2, the client seed is sapphire-player-07, and the nonce is 33.
| Server seed (revealed later) | sapphire-srv-41c9e2 |
|---|---|
| Commitment shown before play: SHA-256(server seed) | 6e401c752211394c99e65d7f2abcaf271b8c88ae17c74ae4ba582150b67bc856 |
| Client seed : nonce : round | sapphire-player-07:33:0 |
| HMAC-SHA256(server seed, message) | 61c8a690938c054034fb3495c43d39941d9c071f2dd38eb80b1c856c458c158f |
| First 4 bytes (8 hex digits) | 61c8a690 = 1,640,539,792 |
| Float = value / 2^32 | 0.3819679357 |
| Rank = floor(float x 13) + 1 | 5 (rank 5) |
One common construction, shown for teaching. Real services document their own message format; check theirs before verifying.
Line by line
- Before any card is dealt, the service shows SHA-256 of the server seed:
6e401c752211394c.... The seed itself stays hidden. - After the seed is revealed, hash it yourself. If your result does not match the commitment exactly, stop: the seed is not the one that was committed.
- Build the message
sapphire-player-07:33:0and compute HMAC-SHA256 with the server seed as the key. The digest starts61c8a690. - Read those first 8 hex digits as a whole number and divide by 2^32. That gives a float between 0 and 1.
- Multiply the float by 13, round down, and add 1. The result is the card rank, from Ace (1) to King (13).
Turning the card into a result
The hash fixes the card, not the outcome of a call. Suppose the previous face card was a 6 and the call was higher. That call wins on 7 through King, which is 53.85% of ranks. The drawn rank above is 5, so against a 6 that call is a loss. The tie rule matters here: it must be stated before the draw, because it decides what happens when the ranks match.
What the check proves
- It proves the card came from the committed seed, your client seed and that nonce, through the published formula.
- It shows the service could not choose the card after seeing your call, as long as the commitment came first.
- It does not show the payout is generous. The edge comes from the pay table, which you check separately.
- It only works if the message format matches what the service documents. A different separator or byte order gives a different card.