-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwolfbet_prng.py
34 lines (24 loc) · 883 Bytes
/
wolfbet_prng.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import hmac
import hashlib
class wolfbet:
def __init__(self):
self.luckynumber = 0
def generator(self, nonce, clientseed, serverseed,):
bserver_seed = serverseed.encode('utf-8') # key
bclient_seed = bytes(clientseed, 'UTF-8')
nonce = nonce
snonce = str(nonce)
bnonce = bytes(snonce, 'UTF-8')
delimiter = bytes('_', 'UTF-8')
message = bclient_seed + delimiter + bnonce
hash = hmac.new(message, bserver_seed,hashlib.sha256).hexdigest()
index = 0
fiveset = 5
number = hash[index:5]
self.luckynumber = int(number,16)
while (self.luckynumber >= 1000000):
number = hash[index:fiveset]
self.luckynumber = int(number,16)
index += 5
fiveset += 5
return float(format(self.luckynumber % 10000 /100, ".2f"))