Skip to main content

fair random with hash prove

Project description

fair random

fair random is a random library with hash prove

>>> from fair_random import get_client_seed, get_server_seed, get_final_seed
>>> client_seed = get_client_seed("123")
>>> client_seed.hash
'a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3'
>>> server_seed = get_server_seed()
>>> server_seed.hash
'b83268d870a9045241918ee76041046e3ca1cb94230bfe6163401ea0ec8df907'
>>> server_seed.server_prove
'19d3b12106df35a87cb784986a8382b3f5eaa5da3bd67e38aa8abc07a5e2ae3d'
>>> final_seed = get_final_seed(server_seed, [client_seed])
>>> final_seed.hash
'a8a8a1a4c5dfbc4bf46dfb7469b21d9e7adb5c6c4bdc316c90bb0cdeb7111856'
>>> dice = Dice()
>>> dice.get_value(final_seed)
3

You can expose server_seed.server_prove before the game starts, allow clients to provide random input, and then expose server_seed.hash after the game ends to demonstrate the immutability of the game.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fair_random-0.0.6.tar.gz (3.5 kB view details)

Uploaded Source

File details

Details for the file fair_random-0.0.6.tar.gz.

File metadata

  • Download URL: fair_random-0.0.6.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for fair_random-0.0.6.tar.gz
Algorithm Hash digest
SHA256 229400590dd5f5afe4b0b2a987e0564d137f57e1968f57473b10c398faa5d885
MD5 d854ca9d0520131d400975c2fa412d91
BLAKE2b-256 5126aa1033313bf98098ff1b6b5919694597825d3c3eb05d1c691c15aaffce8d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page