Hash Issues
| From: | Erbacher Karl | Date: | Thu, 24 Feb 2005 16:26:35 +0000 |
| Subject: | Hash Issues | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-209357@lists.php.net to get a copy of this message | ||
Hello,
I'm trying to hash passwords before saving them to a mySQL database but I am
having a problem. I created three seperate sample users with three different
passwords (password1, password2, password3). When I go back to look at the
table info in the database, it has saved the exact same hash value for all
three users. Any ideas why this might be happening?
The script is very straight forward.
The form that collects the data:
<input type='password' name='password'>
$pass=bin2hex(mhash(MHASH_SHA1, $password));
<input type='hidden' name='pass' value='$pass'>
The file that verifies the data and stores it to the database:
$pass=$_POST['pass'];
INSERT INTO table (username, password) VALUES ('$logname', '$pass');
Thanks,
Cat