Skip to content

Instantly share code, notes, and snippets.

@cx0der
Created August 12, 2018 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cx0der/b81895cef52c1f5de6776f7d62b26d65 to your computer and use it in GitHub Desktop.
Save cx0der/b81895cef52c1f5de6776f7d62b26d65 to your computer and use it in GitHub Desktop.
Pychain calcuate hash
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