hash issues

From: Date: Wed, 23 Feb 2005 02:25:25 +0000
Subject: hash issues
Groups: php.general 
Request: Send a blank email to php-general+get-209310@lists.php.net to get a copy of this message
I am creating a database where I need people to log in using a unique username and password. I would like to hash the passwords using the one-way function mhash(). However, when I try to do this, I have some issues that I cannot figure out. Here is what I have (I'll include every mention of the variable in case I am missing something obvious): The file that displays the sign-up form: The user enters a username and password into the form, the password is hashed and the hashed value is stored in the database. <input type='password' name='password' max length='50'> $pass=bin2hex(mhash(MHASH_SHA1, $password)); <input type='hidden' name='pass' value='$pass'> The input is sent to a file that verifies the data and stores it to the database $pass=$_POST['pass']; INSERT INTO table (username, password) VALUES ('$logname', '$pass'); Here's my big 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 shows that all three of the passwords are exactly the same. I'm not sure why this is happening.

« previous php.general (#209310) next »