Author

Topic: Need Help With Code On Dice Site (Read 672 times)

hero member
Activity: 658
Merit: 500
Respect All Fear None
May 27, 2014, 06:31:00 PM
#3
That's the code we're trying to implement but the values we use are producing anything from negative numbers to INF
hero member
Activity: 569
Merit: 500
May 27, 2014, 12:08:26 PM
#2
Hello as some of you know I am the owner of the crypto currency community CryptoInfinity.com I am working with a developer to set up a custom altcoin dice site and I am wondering if someone can show me a example on how to create a function that roll the dice using the 3 keys below to be fair.

Provably-fair dice-role script/function
Use 3 keys as seed
Client Key
Server Key (randomly generated)
Secret Key (randomly generated daily)

Need those three keys to be used to generate a random 0-100 number

If someone can help me that would be greatly appreciated.

You can find the method easily at any one of the existing dice sites.
For example, you can go to PD and find the following in the "verification" section.
Quote

...

To verify your provably fair bet, simply take the sha512 hash of our secret with the client seed and server
seed (In the order: secret, server seed, client seed). Take the first 8 digits of the new sha512 hash and
convert it from hex to decimal. You will then need to divide by 42949672.95 [Which is ((2^32-1)/100] in
order to get a 0-100 base 10 numeric value. This value will have been the roll.

...

Example php code you can also use:

$seed = $argv[1];
$server = $argv[2];
$client = $argv[3];

$hash = hash('sha512', $seed . $server . $client);

$value = substr($hash, 0, Cool;
$dice = round(hexdec($value)/42949672.95,2);

echo "\{$hash\} - \{$dice\} ";
hero member
Activity: 658
Merit: 500
Respect All Fear None
May 26, 2014, 05:25:23 PM
#1
Hello as some of you know I am the owner of the crypto currency community CryptoInfinity.com I am working with a developer to set up a custom altcoin dice site and I am wondering if someone can show me a example on how to create a function that roll the dice using the 3 keys below to be fair.

Provably-fair dice-role script/function
Use 3 keys as seed
Client Key
Server Key (randomly generated)
Secret Key (randomly generated daily)

Need those three keys to be used to generate a random 0-100 number

If someone can help me that would be greatly appreciated.
Jump to: