Skip to content

Instantly share code, notes, and snippets.

@jbellenger
Last active June 15, 2017 21:46
Show Gist options
  • Save jbellenger/e3cde645b20f15260c9f9189a7cb8f7c to your computer and use it in GitHub Desktop.
Save jbellenger/e3cde645b20f15260c9f9189a7cb8f7c to your computer and use it in GitHub Desktop.
RawModule hash code issue
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