SHA256 for provably-fair game hashes 002
Hello fellow Steemers,
After having explained the provably-fair concept, it’s time to present to you the SHA256 cryptographic algorithm that will be used to generate our hash chain.
Last part of this series will be the generation of the hash chain in Python.
2) SHA256 or how to ensure security for both the players and the house

Presentation
The SHA (Secure Hash Algorithm) allows to verify the integrity of data. By hashing a file, an output (hash) is generated. By comparing it to future hashes of the same file, you could see if the file has been altered (thus generating a different hash).
To ensure the utility of those hash algorithms, you need to be sure that two different inputs can not generate the same output, and that is called collision resistance. It is a key notion in cryptography.
Output
Encrypting a string, a file or any digital data in SHA256 will result in a string of 64 characters such as c5ea03563e182f35a8031e560f8da452d42f1fdf7b1b2e2c756eb3da32c00c3e
The SHA256 is currently used in the bitcoin network for :
- Mining through Proof-of-Work,
- Creating adresses.
Collisions
As seen precedently, the only thing that could compromise an encryption algorithm such as SHA256 would be a collision (two different inputs giving the same output).
What are the chances of that hapenning ? Galvatron gave an eloquent answer on Stack Exchange : using all computational power of the bitcoin network, it would take 39 times the lifespan of our universe, without taking in account all problems needed to store and compare the hashes throughout the network.
Of course with new technologies, collisions could happen as computational power increases but new cryptographic algorithm will surely emerge (the 3 rd generation of SHA - SHA3. is already functional and safer).
Back to our provably-fair game
So SHA256 satisfies our requirements :
- Nobody will find a collision in the hash chain and therefore be able to predict games by reproducing the hash chain, protecting the operator,
- There’s no way for the casino to alter a game and still get continuity in the hash chain, offering protection against manipulation to the players.
Thanks for reading,
See you soon for Part 3 : Generating a hash chain in Python