Comparing Hashed Passwords
Posted: Thu Aug 14, 2008 2:47 am
I have created an SQL database containing a list of Username's and password's and have hashed these passwords using md5. The problem i am now having is that when i take an entered password and try to compare it to the one in the database for a match the result comes back incorrect. without the hashing it works fine.
The code I am using to compare the passwords is as follows:
$passwordhash = md5($_POST['fpassword']);
$sql = "SELECT loginName FROM Member WHERE loginName='$_POST[fusername]' AND password='$passwordhash'";
The code I am using to compare the passwords is as follows:
$passwordhash = md5($_POST['fpassword']);
$sql = "SELECT loginName FROM Member WHERE loginName='$_POST[fusername]' AND password='$passwordhash'";