Created
May 27, 2018 08:32
-
-
Save Aniket-Engg/cc7bfe1604720af14a61a5909abcffcb to your computer and use it in GitHub Desktop.
Block Hash calculation
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
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