Created
August 12, 2018 12:31
-
-
Save cx0der/b81895cef52c1f5de6776f7d62b26d65 to your computer and use it in GitHub Desktop.
Pychain calcuate hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hashlib | |
def calculate_hash(index, nonce, timestamp, data, prev_hash): | |
block_val = str(index) + str(nonce) + prev_hash + str(timestamp) + data | |
return hashlib.sha256(block_val.encode("utf-8")).hexdigest() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment