Post
Topic
Board Gambling
Re: SatoshiDICE.com - The World's Most Popular Bitcoin Game
by
dooglus
on 24/03/2013, 19:43:55 UTC
I'm not quite sure, but for programming reasons I'm seriously expecting the maximum number to be 65535.

It's a ridiculous oversight to not state the maximum number on the site. Also, the reasons why the number is so large is major geekery

The range is 0 to 65535 inclusive.

In PHP, the magic number can be calculated as:
  hexdec(substr(hash_hmac('sha512', "$txid:$nout", $secret), 0, 4))

ie. the first 4 hex characters of the sha512 hmac of (the transaction id, a colon, and the output number) with the daily secret.  As a decimal.

There's a webpage that independently calculates your random numbers given the daily secret and the bet transaction ID.

I never noticed that it doesn't state the range of the random number anywhere on site before.  That is surprising.

If the range wasn't so big, they couldn't offer a 64000x payout unless they generated multiple numbers per bet.