Page 1 of 1

crypt() on Windows server

Posted: Mon Apr 19, 2010 2:03 pm
by NeoBasilisk
I've been using the crypt function in an application on a Windows server for about 9 months now. I use the first two characters of the supplied password as the salt value for the crypt call. Some time within the past couple days, it appears that the crypt function has started to return different values, so no one can log into the site at the moment. I've taken the same code and tested it on a Unix server, and it's returning the same values that the Windows server used to be returning.

As far as I can tell, nothing was changed on the server recently. PHP was not updated. Any ideas on what is going on here?

*edit*
Here's a simplified example.

$password = "1234567";
$salt = substr($password, 0, 2);
$password = crypt($password, $salt);
print $password;

On the Windows server, this is the output.
12Lx4XqsQOTdk

On the Unix server, this is the output.
120QBxD1IX.Cw

Re: crypt() on Windows server

Posted: Mon Apr 19, 2010 8:25 pm
by John Cartwright
The description of the crypt() function explains why different algorithms may be used.