I am using this code to implement blockchain.
const sha256 =require('crypto-js/sha256');
class block{
constructor(timestamp,nonce,value,prevhash)
{
this.timestamp=timestamp;
this.nonce=nonce;
this.value=value;
this.prevhash=prevhash;
}
calculate(){
return String(sha256(this.timestamp,this.nonce,this.value,this.prevhash));
}
}
const block1=new block(22,345,"changebro",345);
const block2 =new block(4385,545,45,2)
console.log(block1.calculate());
console.log(block1);
console.log(block2.calculate());
console.log(block2);
why the ans for both is coming same.
for both I am getting same ans 4ea5c508a6566e76240543f8feb06fd457777be39549c4016436afda65d2330e