Created
March 27, 2018 04:59
-
-
Save zthxxx/7c649ee3a766304b893c395f499907d9 to your computer and use it in GitHub Desktop.
Proof of work in CTF-wirteup
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
cosnt crypto = require('crypto') | |
const md5sum = str => crypto.createHash('md5').update(str).digest('hex') | |
function PoW(target, start, end) { | |
while (true) { | |
let rand = Math.random().toString(36) | |
let hash = md5sum(rand).slice(start, end) | |
if (hash === target) return rand | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment