index.js (362B)
1 const fs = require('fs'); 2 const { hex_md5 } = require('@finwo/digest-md5'); 3 4 const secret = fs.readFileSync('input', 'utf-8').trim(); 5 const difficulty = 6; 6 const matcher = '0'.repeat(difficulty); 7 let nonce = 0; 8 9 while(hex_md5(secret + nonce).substr(0,difficulty) != matcher) nonce++; 10 11 console.log({ secret, hash: hex_md5(secret + nonce), nonce });