Re: crypt()
| From: | Ewout de Boer | Date: | Wed, 07 Aug 2002 16:54:53 +0000 |
| Subject: | Re: crypt() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-111536@lists.php.net to get a copy of this message | ||
> I am having a strange problem with the crypt function. I have been using
> crypt to generate passwords for a .htaccess like this;
>
> $cpassword = crypt($password);
>
> This has been working fine for the past couple of weeks. But this morning
> for some reason it stopped working. I made no changes to the script, I am
> however on a shared host so something may have changed on the server (I am
> just not sure what). Anyway, in trying to figure out what happened I wrote
a
> script that does the same thing in perl to try to isolate the problem.
When
> I crypt the password with perls version crypt (in the cgi script) it
works.
> Here are the two encrypted passwords I have been using for testing. The
> password is shadow. The perl output from crypt is Md/w17y56z8Xc. The php
> output is from crypt is $1$kx4aditc$xkrhdSA3zTQY21Frtp51e0 . The perl
output
> works in my .htaccess file and the php version used to but no longer does.
> It looks like php is using a different algorithm then php. Any help would
be
> appreciated.
Your script is using MD5 encryption, but you can force another encryption
by using the second argument of the crypt function (the salt). If you use
2 characters as salt the crypt function wil use standard DES again.
For more information www.php.net/crypt
---
Ewout de Boer
Chemistry Interactive Media