Skip to content

Instantly share code, notes, and snippets.

@Aniket-Engg
Created May 27, 2018 08:32
Show Gist options
  • Save Aniket-Engg/cc7bfe1604720af14a61a5909abcffcb to your computer and use it in GitHub Desktop.
Save Aniket-Engg/cc7bfe1604720af14a61a5909abcffcb to your computer and use it in GitHub Desktop.
Block Hash calculation
var calculateHashForBlock = (block) => {
return calculateHash(block.index, block.previousHash, block.timestamp, block.data);
};
var calculateHash = (index, previousHash, timestamp, data) => {
return CryptoJS.SHA256(index + previousHash + timestamp + data).toString();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment