Skip to content

Instantly share code, notes, and snippets.

@NaokiStark
Created January 20, 2018 01:21
Show Gist options
  • Save NaokiStark/c4bc89c7f231201d232332be51752242 to your computer and use it in GitHub Desktop.
Save NaokiStark/c4bc89c7f231201d232332be51752242 to your computer and use it in GitHub Desktop.
//(sha256)
function MineHash(startHash, diff){
hashCalc = "";
startsWith = diff;
number = 0;
while(hashCalc.substring(0, startsWith) != "0".repeat(startsWith)){
number++;
hashCalc = sha256(startHash+number);
}
return {hash:hashCalc, n:number};
}
var hash = MineHash("xd", 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment