1) How can I divide a hash string by a number or use in in a math forumla? doest hashes have numerical value ?
Good question. Hashes are really just very big numbers. They are usually written in hexadecimal (base 16) which uses digits 0-9 and a-f. 'a' means 10, 'b' means 11, ..., 'f' means 15.
Rather than the decimal (base 10) system, where "246" means 2 hundreds (ten squared), 4 tens and 6 ones, in hexadecimal "246" would mean 2 (16 squareds), 4 sixteens and 6 ones.
So even though the hash string has letters a through f in it, it is still just a number, and can be divided by other numbers.
2) the value of e is generated randomly or its derived out of something ?
e is just 2 to the power of 52. It is one greater than the maximum value that can be represented by a 13 digit hexadecimal number.
if you can show me an exmaple of this calculation it would be great.
I can try. I just went to bustabit and screenshotted the most recent crashes:
I copied the full hash of the top row. It is 0f81acc25a875c843f3ee3f9563bfa875be311d7585306e743120a4e68f51f0f
Then I checked that each of the next hashes forms a chain:
$ echo -n 0f81acc25a875c843f3ee3f9563bfa875be311d7585306e743120a4e68f51f0f | sha256sum
1da773ad50c9f5ce2098713e90bfe667c467fb1e1b14d3623113336899cfff4c -
$ echo -n 1da773ad50c9f5ce2098713e90bfe667c467fb1e1b14d3623113336899cfff4c | sha256sum
c0799484b3dda03da0ab75f21ea6c34ee636dcfa40be81bc44ade2bcd6760754 -
$ echo -n c0799484b3dda03da0ab75f21ea6c34ee636dcfa40be81bc44ade2bcd6760754 | sha256sum
ba5faf9f3b9c84ac1d7ddc957a2376e9cb3638ac6f54ad4274febdf5beec2632 -
$ echo -n ba5faf9f3b9c84ac1d7ddc957a2376e9cb3638ac6f54ad4274febdf5beec2632 | sha256sum
5d3ebb05c6b2b5ab6a7397a820ae8d710712f7cf2376630dd2ed3fa747ec325c -
That shows that the sha256 hashes are chained as described. Each game's hash is the sha256 hash of the next game's hash.
To do the calculations, I'm going to use 'nodejs', a standalone Javascript interpreter:
$ nodejs
> crypto = require('crypto');
> e = Math.pow(2,52); // e is just 2^52
4503599627370496
> clientSeed = '000000000000000007a9a31ff7f07463d91af6b5454241d5faf282e5e0fe1b3a'; // hash of block 339300
'000000000000000007a9a31ff7f07463d91af6b5454241d5faf282e5e0fe1b3a'
> serverSeed = '0f81acc25a875c843f3ee3f9563bfa875be311d7585306e743120a4e68f51f0f'; // this is the server seed shown when the game is over
'0f81acc25a875c843f3ee3f9563bfa875be311d7585306e743120a4e68f51f0f'
> hash = crypto.createHmac('sha256', serverSeed).update(clientSeed).digest('hex'); // combine the server seed with the client seed
'1cda7a31c271dd9e8b95798aedb9d6adfd83de975f5edd8315de7675b1cdc9ea'
> first13 = hash.slice(0,13); // take the first 13 digits of the hash
'1cda7a31c271d'
> h = parseInt(first13, 16); // convert it from hexadecimal to decimal
507594856474397
> Math.floor((100 * e - h) / (e - h)) / 100 // apply the formula to get the crash point
1.12
> serverSeed = '1da773ad50c9f5ce2098713e90bfe667c467fb1e1b14d3623113336899cfff4c';
'1da773ad50c9f5ce2098713e90bfe667c467fb1e1b14d3623113336899cfff4c'
> hash = crypto.createHmac('sha256', serverSeed).update(clientSeed).digest('hex');
'e2b986d935a2696722fe80a862ea044a12682341175fda4b6419524f2b38e75b'
> first13 = hash.slice(0,13);
'e2b986d935a26'
> h = parseInt(first13, 16);
3988583347345958
> Math.floor((100 * e - h) / (e - h)) / 100
8.66
> serverSeed = 'c0799484b3dda03da0ab75f21ea6c34ee636dcfa40be81bc44ade2bcd6760754';
'c0799484b3dda03da0ab75f21ea6c34ee636dcfa40be81bc44ade2bcd6760754'
> hash = crypto.createHmac('sha256', serverSeed).update(clientSeed).digest('hex');
'6798fcb15192969301ce58db9010a8d3ad4c53d834a63fd090d41851f5b07900'
> first13 = hash.slice(0,13);
'6798fcb151929'
> h = parseInt(first13, 16);
1822508354705705
> Math.floor((100 * e - h) / (e - h)) / 100
1.67
> serverSeed = 'ba5faf9f3b9c84ac1d7ddc957a2376e9cb3638ac6f54ad4274febdf5beec2632';
'ba5faf9f3b9c84ac1d7ddc957a2376e9cb3638ac6f54ad4274febdf5beec2632'
> hash = crypto.createHmac('sha256', serverSeed).update(clientSeed).digest('hex');
'bed205075a7b1ce33616840b9681a5b84522bf34b26ff3e758c3eb788b1e49af'
> first13 = hash.slice(0,13);
'bed205075a7b1'
> h = parseInt(first13, 16);
3356947788441521
> Math.floor((100 * e - h) / (e - h)) / 100
3.89
> serverSeed = '5d3ebb05c6b2b5ab6a7397a820ae8d710712f7cf2376630dd2ed3fa747ec325c';
'5d3ebb05c6b2b5ab6a7397a820ae8d710712f7cf2376630dd2ed3fa747ec325c'
> hash = crypto.createHmac('sha256', serverSeed).update(clientSeed).digest('hex');
'd7f97ec4c79f14c1e731101c7422facd5e0662eeb5481eaba9a7a681588f5697'
> first13 = hash.slice(0,13);
'd7f97ec4c79f1'
> h = parseInt(first13, 16);
3799465178462705
> Math.floor((100 * e - h) / (e - h)) / 100
6.34
I had to tell it the client seed, which is the hash of
block 339300 - a block height that was picked before the block was solved, in the
seeding event post, and each of the server seeds. From that information it was able to calculate the 5 crash points from the image. I didn't check whether the hashes were divisible by 101 (because I don't know how to using node), so let's do it in Python:
$ python
Python 2.7.9 (default, Mar 1 2015, 12:57:24)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 0x0f81acc25a875c843f3ee3f9563bfa875be311d7585306e743120a4e68f51f0f % 101
20L
>>> 0x1da773ad50c9f5ce2098713e90bfe667c467fb1e1b14d3623113336899cfff4c % 101
43L
>>> 0xc0799484b3dda03da0ab75f21ea6c34ee636dcfa40be81bc44ade2bcd6760754 % 101
41L
>>> 0xba5faf9f3b9c84ac1d7ddc957a2376e9cb3638ac6f54ad4274febdf5beec2632 % 101
4L
>>> 0x5d3ebb05c6b2b5ab6a7397a820ae8d710712f7cf2376630dd2ed3fa747ec325c % 101
22L
That's showing the remainder after dividing each hash by 101. It's not zero for any of them, so the crash point is never 0x.
2) Also how are the odds of X multiplier to appear are calculated ?
I don't remember the details of that. I did work through it once, and found an error, so Eric (I think) ended up fixing the code.
I can understand that this method is weak because you need to trust the site owners to generate true random numbers and strings.
Yes - it's one thing for the owners to prove that they picked the outcome before you played (by publishing its hash), but that's not enough. They should also be able to prove that they had no control of the outcome. If you're playing roulette, and picking red or black, it's not enough for me to prove that I committed to rolling green "zero" before you made your bet. I should also be able to prove that I'm not picking zero more often than I should be.
That is the point of the "seeding event" I linked to above.