Skip to content

Instantly share code, notes, and snippets.

@zthxxx
Created March 27, 2018 04:59
Show Gist options
  • Save zthxxx/7c649ee3a766304b893c395f499907d9 to your computer and use it in GitHub Desktop.
Save zthxxx/7c649ee3a766304b893c395f499907d9 to your computer and use it in GitHub Desktop.
Proof of work in CTF-wirteup
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