-1

I'm trying to verify dice rolls but getting wrong roll numbers generated. I've tried official verification script from 2 sites:

Can you help me understanding why I can't get the same roll numbers as on sites...Let's focus on primedice, because I think the issue is surely similar.

details of a primedice.com roll:

roll #20,549,462,672
server seed (hashed) : a72c7d6e95b7122dc21968505b91d729f4eef30af2c019488bb76274290ad183
client seed (nonced) : a9e65af098fe00229917de5659746dda-28

roll number shown on site: 35.02

I suppose the nonce to use there is 28 in the code. so I fill nodejs variable as this:

var clientSeed = "a9e65af098fe00229917de5659746dda";
var serverSeed = 
"a72c7d6e95b7122dc21968505b91d729f4eef30af2c019488bb76274290ad183";
var nonce      = 28;

//----- official roll function from primedice.com

var crypto = require('crypto');

var roll = function(key, text) {  
    var hash = crypto.createHmac('sha512', key).update(text).digest('hex');    
    var index = 0;    
    var lucky = parseInt(hash.substring(index * 5, index * 5 + 5), 16);
    while (lucky >= Math.pow(10, 6)) {        
    index++;        
    lucky = parseInt(hash.substring(index * 5, index * 5 + 5), 16);        //if we reach the end of the hash, just default to highest number        
    if (index * 5 + 5 > 128) {            
        lucky = 99.99;            
        break;        
    }    
}    
lucky %= Math.pow(10, 4);    
lucky /= Math.pow(10, 2);    

return lucky;
} 

console.log(roll(serverSeed, clientSeed+'-'+nonce));

then used the roll function as given by the site. the result generated was:

 roll number generated :  50.64

so 50.64 is not what the site shows ==> 35.02

Any idea?

Rich L
  • 1,905
  • 2
  • 19
  • 30
Jean F.
  • 127
  • 8

1 Answers1

1

I understand what the problem is. Here is the roll to verify

roll #20,549,462,672
server seed (hashed) : 
a72c7d6e95b7122dc21968505b91d729f4eef30af2c019488bb76274290ad183
client seed (nonced) : a9e65af098fe00229917de5659746dda-28

As you can see, it shows "server seed (hashed)". You cannot calculate the right value with a hashed representation of the seed. You will need the real seed to get the right number.

Knowing the real seed would mean you can bet and be 100% sure to win on each new roll.

So, the service won't let you see the server seed that is used to let you bet. You must do a seeds change then the server will show you the real seed used for your last sessions.

Therefore you can only verify rolls numbers from an old server seed, not from the current one, since it is kept secret by the service for security reasons.

Jean F.
  • 127
  • 8