You are here: hash issues « PHP « IT news, forums, messages
hash issues

Posted by Erbacher Karl on 02/23/05 04:25

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация