Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

MD5 cracker


ghost's Avatar
0 0

I'm having some trouble with my MD5 cracker function I'm trying to create in PHP. Not sure why it's not working, but here's the code:

<?
function hashcrack($string) {
  $words = str_ireplace(",", " ", file("http://www.site.com/wordlist.txt"));
  foreach ($words as $word) {
    $word = trim($word);
    if (md5($word) == $hash) {
      return $word;
    }
  }
  return false;
}
if ($result == $hash) {
  echo "hash matches $result";
} else {
  echo "No match found";
}
?>

Hope this doesn't look familiar. :ninja:


ghost's Avatar
0 0

$hash and $result aren't declared i think by $hash you mean $string, which is the md5 string

might consider using else if instead of two "if"s

just after a quick glance, don't hold me to it


ghost's Avatar
0 0

sharpskater80 wrote: $hash and $result aren't declared

might consider using else if instead of two "if"s

just after a quick glance, don't hold me to it

According to others, that's correct. The variables are declared there. But that had me for a while as I was trying to figure out how to extract the info from above. :angry: And I closed the first if, I believe it needs to be closed there. I could be wrong though.


ghost's Avatar
0 0

pm me the full code and i can probably help more


richohealey's Avatar
Python Ninja
0 0

you don't call your hashcrack fucntion….


ghost's Avatar
0 0

richohealey wrote: you don't call your hashcrack fucntion….

Lol yeah, that's not the whole code that's only the function. But when I call the function it doesn't work.


ghost's Avatar
0 0

heres a snippet from a larger code i had that may help you at least a little


function md5crack($hash, $words) {

    if (strlen($hash) == 32) {

        $words = file("$words");

        foreach ($words as $word) {

            $word = rtrim($word);

            if (md5($word) == $hash) {

                return "
                    <b>Plaintext found!</b>
                    <br />
                    <br />
                    $hash = <b>$word</b>"
                    exit;

            }

        }

    } else {

        return "String is not md5!";
        exit;

    }

    return "Not found!";

}

?>```

ghost's Avatar
0 0

[color=pink]www.Google.com/[/color]


spyware's Avatar
Banned
0 0

KAC7 wrote: [color=pink]www.Google.com/[/color]

If you're not going to post something useful why post at all? CANCER! You will be banned, tard. Over and over again.

May you burn in hell. [ontopic]


ghost's Avatar
0 0

KAC7 wrote: [color=pink]www.Google.com/[/color]

Why would I need google? There's was no error in my syntax I simply left something out, something that should have been easily spotted ;) what can I say I was tired. Here's the working function:

function hashcrack($hash) {
$words = explode(",",file_get_contents("site.com/dictionary.txt");
$i = 0;
foreach ($words as $word){
if (md5($word) == $hash)
return $word;
else
$i++;
}
}
//end hashcrack function