βš–οΈProvably Fair

Check the result. To verify that the two hashes really gave the number that came out. Do the steps below.

Combine the server_seed and client_seed into a sigle string. The server_seed come's first and the client_seed next.

Use a SHA3-256 hash generator to hash the combined string. You can use any online SHA3-256 generator for this step, such as link

Take the hash and convert to an integer using hexadecimal conversion.

The code below, is an example how we generate the number using the hash.

def generate_number_and_hash(server_seed: str, client_seed: str): number_seed = server_seed + client_seed random_number_hash = hashlib.sha3_256() random_number_hash.update(number_seed.encode('utf-8')) random_number_hex = random_number_hash.hexdigest()

random_number_int = int(random_number_hex, 16)

return random_number_int, random_number_hash

Use the integer random_number_int obtained and calculate the multiplier using the code below:

def get_multiplier(random_number_int): random_number = random_number_int % 100 if random_number < 3: return 1.0 else: random_number = random_number_int % 1000 d_rand_num = random_number_int / 1000 x = 99 / (1 - d_rand_num)

    x = math.floor(x)

    multiplier = max(1, x / 100)
    if multiplier > 150:
        return 150

    return multiplier

Compare the results

You can get the calculated multiplier and compare to the multiplier provided at the end of the game, this is how you can check that's a fair game.

Last updated