Hi list and Ben:
> I have a string that I want to MD5 (No prizes for guessing its a
> password), what I want to do is MD5 two strings (one supplied
> by the user, and one by my server) and compare them. How can
> I do this?
<<snipped the rest>>
MD stands for message digest, in brief a fixed length hash based
upon the string hashed. It is a one way algorithm and the easiest
way to crack it is the same solution is what you are after, i.e.
string comparison. Lets take an example;
<?php
// Initialise variables
$my_stored_password=<a pre hashed md5 string>;
$the_users_password=<a password entered by the user>;
// md5 hash the users password
$md5_users_password=md5($the_users_password);
// do a hash comparison
if($md5_users_password == $my_stored_password):
{
print "It matches!";
}
else:
{
print "Password comparison failed!";
}
endif;
?>
Remember, any value hashed by md5 will provide the same result,
always.
Hope this helps you. If you need any more information, feel free to
mail the list or me.
Regards Jerry.
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]