Git Product home page Git Product logo

Comments (3)

adeora7 avatar adeora7 commented on July 20, 2024

@lhartikk Please look !

from naivechain.

lhartikk avatar lhartikk commented on July 20, 2024

Hi

I was not able to reproduce the problem you described. The calculateHash function will output different hash, if the timestamp changes:

var CryptoJS = require("crypto-js");

var calculateHash = (index, previousHash, timestamp, data) => {
    return CryptoJS.SHA256(index + previousHash + timestamp + data).toString();
};

var hash1 = calculateHash(1, "816534932c2b7154836da6afc367695e6337db8a921823784c14378abed4f7d7", 1465154705, {});
var hash2 = calculateHash(1, "816534932c2b7154836da6afc367695e6337db8a921823784c14378abed4f7d7", 1465154706, {});

console.log(hash1);
console.log(hash2);

output:

b5d0ef20b1b334599a1f6f1474d6e341d3356d5db0f13075664693a670d0f334
7c81ee6c156924933bb5cc299dab7b00bb066f09f180d712131c0e73164b0963

from naivechain.

adeora7 avatar adeora7 commented on July 20, 2024

from naivechain.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.