Monday, May 30, 2011

PHP MD5

To MD5 some data is easy simply use the md5() function.
<?php
echo md5("hello");
?>
Store it in a variable
<?php
$md5_string = md5("hello world");
echo $md5_string;
?>
You can check if a string is an md5 string by comparing the two together, since it's a one-way hashing algorithm, this is called "colliding".
<?php
$password = md5("password");
$user_input = "password";
if(md5($user_input) == $password)
{
        echo "the password hash is <b>".$user_input."</b>.";
} else {
        echo "the password hash is NOT <b>".$user_input."</b>.";
}
?>
If you load a word list and loop through it, you have yourself a quick rough hash cracker.

No comments:

Post a Comment