Created
September 6, 2017 02:32
-
-
Save gibatronic/2c3ac88afe06a9e2b0f2e9d42fb553b9 to your computer and use it in GitHub Desktop.
This file contains 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'); | |
let hash; | |
let index = 0; | |
function check() { | |
const data = hash.read().toString('hex'); | |
hash.removeListener('readable', check); | |
if (data.substr(0, 10) != '0000000000') { | |
index++; | |
return process.nextTick(main); | |
} | |
console.log(data); | |
console.log(index); | |
} | |
function main() { | |
hash = crypto.createHash('sha256'); | |
hash.on('readable', check); | |
hash.write(index.toString()); | |
hash.end(); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment