--- a/compare-mg.js +++ b/compare-mg.js @@ -5,6 +5,9 @@ // and the 30-second progress lines (" ... x=29 mode=1 34% 34.8s"), whose count depends on machine speed. // Usage: node compare-mg.js research/maxgap-law.js out-mg-big.txt [out-mg.txt] const fs = require('fs'); +const { createHash } = require('node:crypto'); +// Commit to every normalized line, including differences omitted from the display. +const digest = lines => createHash('sha256').update(JSON.stringify(lines), 'utf8').digest('hex'); const src = fs.readFileSync(process.argv[2], 'utf8').split('\n'); const b = src.findIndex(l => l.startsWith('// body-lines:')); const n = Number(src[b].split(':')[1]); @@ -25,6 +28,7 @@ if (first !== null) { for (let i = first; i < Math.min(first + 6, m); i++) console.log(` line ${i + 1}\n EMB: ${E[i]}\n RUN: ${R[i]}`); } + console.log(`${label}: normalized SHA256 embedded ${digest(E)} run ${digest(R)}`); return { E, R }; } console.log(`embedded block: ${n} body lines`);