Last active
June 15, 2017 21:46
-
-
Save jbellenger/e3cde645b20f15260c9f9189a7cb8f7c to your computer and use it in GitHub Desktop.
RawModule hash code issue
This file contains hidden or 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
const crypto = require('crypto'); | |
const RawModule = require('./lib/RawModule'); | |
const hashModule = (module) => { | |
const hash = crypto.createHash('sha256'); | |
module.updateHash(hash); | |
return hash.digest('hex'); | |
}; | |
const hashFoo = hashModule(new RawModule('foo')); | |
const hashBar = hashModule(new RawModule('bar')); | |
if (hashFoo === hashBar) { | |
console.log("modules with different sources have same module hash:"); | |
console.log(' ', hashFoo); | |
process.exit(1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment