Skip to content

Instantly share code, notes, and snippets.

@nikoncode
Created January 18, 2015 23:13
Show Gist options
  • Select an option

  • Save nikoncode/a6c7a37e60fbcfceda16 to your computer and use it in GitHub Desktop.

Select an option

Save nikoncode/a6c7a37e60fbcfceda16 to your computer and use it in GitHub Desktop.
123321
function getmicrotime() {
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec + (float)$sec);
}
$time_start = getmicrotime();
$charset = 'abcdefghijklmnopqrstuvwxyz';
$str_length = strlen($charset);
$hash_password = "ee2a23af409b352d8f1819405bc770b2";
function check($password)
{
global $hash_password, $time_start;
if (hash("md5", $password) == $hash_password) {
echo "\n\n" . "FOUND MATCH, password: " . $password . "\n\n";
$time_end = getmicrotime();
$time = $time_end - $time_start;
echo "Found in " . $time . " seconds\n";
exit;
}
}
function recurse($width, $position, $base_string)
{
global $charset, $str_length;
for ($i = 0; $i < $str_length; ++$i) {
if ($position < $width - 1) {
recurse($width, $position + 1, $base_string . $charset[$i]);
}
check($base_string . $charset[$i]);
}
}
echo "Target hash: " . $hash_password . "\n";
recurse(5, 0, '');
echo "Execution complete, no password found\r\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment