Skip to content

Instantly share code, notes, and snippets.

@bitnetwork
Last active February 23, 2017 01:05
Show Gist options
  • Save bitnetwork/e69cc7068be35b814203254319edabe6 to your computer and use it in GitHub Desktop.
Save bitnetwork/e69cc7068be35b814203254319edabe6 to your computer and use it in GitHub Desktop.
const lib_crypto = require("crypto");
let mode = 0; // 0: bruteforce, 1: dictonary, 2: rainbow
let hashes = [
"86a1ea3adf8fbb53eb7a9b6b6b01c020", "099b3b060154898840f0ebdfb46ec78f",
"912ec803b2ce49e4a541068d495ab570", "1a1dc91c907325c69271ddf0c944bc72",
"81dc9bdb52d04dc20036dbd8313ed055", "3d3e47f4b9143d4d788b5bda77ba41f9",
"902fbdd2b1df0c4f70b4a5d23525e932", "4a7d1ed414474e4033ac29ccb8653d9b",
"912ec803b2ce49e4a541068d495ab570", "6d87a19f011653459575ceb722db3b69",
"9996535e07258a7bbfd8b132435c5962", "17d33d006957f5528a413429c3049b35"];
let cracked = {};
let charset = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
let dictonary = [];
switch (mode) {
case 0:
var index = [0];
while (hashes.length !== cracked.length) {
var attempt = "";
for (var i = 0; i < index.length; i++) {
attempt = charset[index[i]] + attempt;
}
//console.log(attempt + " - " + index);
var attemptHash = lib_crypto.createHash("md5").update(attempt).digest("hex");
for (var i = 0; i < hashes.length; i++) {
if (attemptHash === hashes[i]) {
console.log(attemptHash + " = " + attempt);
cracked[attemptHash] = attempt;
}
}
index[0]++;
for (var i = 0; i < index.length; i++) {
if (index[i] >= charset.length - 1) {
index[i] = 0;
if (typeof index[i + 1] === "number") {
index[i + 1]++;
} else {
index[i + 1] = 0;
}
}
}
}
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment