MD5 Hashing Comparison

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I'm trying to write a md5 hash to auth users... And before I get flamed
about md5 not being a crypt system but a hashing system I know... Security
is not a problem..
I'm trying to build a standalone Message Update Center intranet with PHP

The problem I'm having is comparing a user inputed word or passphrase and
comparing the code to the hash on a mysql database....

here's the code....
<?php

// connect to database

$connection = mysql_connect("localhost","root");

mysql_select_db("forum");

$result = mysql_query('Select username, password from users');

while($row = mysql_fetch_array($result, MYSQL_ASSOC))

{ // start while fetch loop

if($_POST['givenuser'] == $row['username'])

{ // Begin user check

if(  md5($_POST['givenpassword']) ==  $row['password'] )

print("Welcome!");

// The problem I'm having is the comaprisons are not accurate.....

// If I display ---> print(md5($_POST['givenpassword']);

// and $row['password'] to the browser all 32 char are identical



} // end user check

} // end while fetch loop

?>

Any Ideas at all? I was thinking that there could be somesort of WHITESPACE
problem in the hashing of the passed var givenpassword

or possible a problem with a wierd floting point calculation at the
comparision level?

thanks in advance

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux