Let's build up our hashBlock method. Inside of this method, we want to use SHA256 hashing to hash our block data. Follow the below mentioned steps:
- To use an SHA256 hashing function, import it as an npm library. To do that, go to Google and type SHA256 into the search bar, or visit https://www.npmjs.com/package/sha256. On this website, you will get to see the command that we need to type into our terminal to install SHA256. We'll have to type in the following command in our terminal:
npm i sha 256--save
- After doing this, press Enter. The --save in the following command will save this library as a dependency for us. Now, inside of our blockchain file structure, you may see that the node_modules folder has appeared. ...