Re: crypt() and md5
| From: | Rasmus Lerdorf | Date: | Mon, 23 Apr 2001 08:08:16 +0000 |
| Subject: | Re: crypt() and md5 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-49818@lists.php.net to get a copy of this message | ||
That means that you do have MD5 crypt() support. If you simply provide a
salt that starts with $1$ you should get an md5-encrypted password.
If you look in a passwd or shadow file that contains md5'ed passwords you
will see something like this:
$1$rZelmysN$Gj0rbqD76STIotGExxpna1
^^^^^^^^^^^^
SALT
So to generate a password like this you would do:
crypt($string,'$1$rZelmysN$');
-Rasmus
On Mon, 23 Apr 2001, Niklas Neumann wrote:
> Hello all,
>
> i would like to crypt a password as secure as possible.
> The documentation says crypt() will use DES unless MD5 is available.
>
> But in my case this doesn't seem to work.
>
> 'echo CRYPT_STD_DES ;' returns 1
> 'echo CRYPT_EXT_DES;' returns 0
> 'echo CRYPT_MD5;' returns 1
> 'echo CRYPT_BLOWFISH;' returns 0
>
> so i will asume, that MD5 is available on my system. But
> 'echo CRYPT_SALT_LENGTH;' returns 2
> and if i test 'crypt('test')'
> the string is only encrypted with DES.
>
> Anybody had similar expieriences? Is this a bug or an error on my side?
>
> Best regards
> Niklas Neumann
>