crypt() on Windows server

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
NeoBasilisk
Forum Newbie
Posts: 1
Joined: Mon Apr 19, 2010 1:46 pm

crypt() on Windows server

Post 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
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: crypt() on Windows server

Post by John Cartwright »

The description of the crypt() function explains why different algorithms may be used.
Post Reply