Skip to content

Instantly share code, notes, and snippets.

@ssaurel
Created December 18, 2019 13:03
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 ssaurel/ddce504bbba685200660f3ef3b0ba316 to your computer and use it in GitHub Desktop.
Save ssaurel/ddce504bbba685200660f3ef3b0ba316 to your computer and use it in GitHub Desktop.
CalculateHash function for a Blockchain in JS on the SSaurel's Blog
function calculateHash(block) {
return sha256(block.index + block.previousHash +
block.timestamp + block.data +
block.nonce);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment