Re: How to compare crypted password with stored in MySQL

From: Date: Wed, 01 Feb 2006 22:35:22 +0000
Subject: Re: How to compare crypted password with stored in MySQL
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-41167@lists.php.net to get a copy of this message
On Wed, 1 Feb 2006, Eduardo Bejar wrote:
Hi, I have a MySQL database with encrypted passwords, that were created with: $input_password = $_POST["password"]; $salt = "ab"; /// Salt is always two character string and the same for all $password_to_save = crypt($input_password, $salt); [snip]
This used to work on a PC that runs PHP 4.1.2 and MySQL 3.23.36. But when trying this on other PC that runs PHP 4.3.11 and MySQL 3.23.58, I get no password match, as $password_to_check is different from the one stored in the database. In example: $password_to_check shows "ab2vG8KakAAGY" and the stored one is "abFcR2QZ/2fUU". What could be causing this? How should I compare the passwords?
http://us2.php.net/crypt seems to say that crypt varies b/n operating systems. Or perhaps it's just using a different encryption algorithm. Check the above url for details... -philip

« previous php.db (#41167) next »