Try doing the hash code after the password is posted

From: "Erbacher Karl" <[EMAIL PROTECTED]>
To: php-general@lists.php.net
Subject: [PHP] Hash Issues
Date: Thu, 24 Feb 2005 08:26:35 -0800
Received: from lists.php.net ([216.92.131.4]) by mc5-f20.hotmail.com with Microsoft SMTPSVC(6.0.3790.211); Fri, 25 Feb 2005 09:30:44 -0800
Received: from ([216.92.131.4:11652] helo=lists.php.net)by pb1.pair.com (ecelerity HEAD r(5124)) with SMTPid 8D/AB-51537-5C06F124 for <[EMAIL PROTECTED]>; Fri, 25 Feb 2005 12:30:45 -0500
Received: (qmail 66774 invoked by uid 1010); 25 Feb 2005 16:28:10 -0000
Received: (qmail 48782 invoked by uid 1010); 25 Feb 2005 15:54:21 -0000
X-Message-Info: 6sSXyD95QpWP6+shjfuSKTd7f5bTEYxLS2AOsK0Gtko=
Return-Path: <[EMAIL PROTECTED]>
X-Host-Fingerprint: 216.92.131.4 lists.php.net Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Precedence: bulk
list-help: <mailto:[EMAIL PROTECTED]>
list-unsubscribe: <mailto:[EMAIL PROTECTED]>
list-post: <mailto:php-general@lists.php.net>
Delivered-To: mailing list php-general@lists.php.net
Delivered-To: [EMAIL PROTECTED]
Delivered-To: [EMAIL PROTECTED]
Lines: 22
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-Posted-By: 68.234.190.142
X-OriginalArrivalTime: 25 Feb 2005 17:30:45.0014 (UTC) FILETIME=[BC9C7360:01C51B5F]


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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to