crypt() will return an encrypted string using the standard Unix DES-based encryption algorithm or alternative algorithms that may be available on the system.

If no Salt-Argument is given, PHP randomly generates a new one with every use of the function.

To generate a .htpasswd password, simple copy your password in $str and click on "run". The parameter $salt must not be filled. Now copy the generated password in your .htpasswd file with a : as separator to the username in a new line (username:password).

declaration of crypt

string crypt ( string $str [, string $salt ] )

test crypt online

share crypt

comments for crypt

On 06. Apr 2015 04:30 beanie wrote:

you need to start the salt with $1$ for MDS or $2a$ for blowfish. if you dont do those (or one of the other existing types) it just uses standard which is only two alphanumeric characters details:

On 20. Mar 2015 11:54 eSkiSo wrote:

This crypt function has some problems... all of these return the same result $returnValue = crypt('MyStringStarted', 'Fixed'); $returnValue = crypt('MyStringFinished', 'Fixed'); $returnValue = crypt('MyStringStarted', 'Filtered'); $returnValue = crypt('MyStringFinished', 'Filtered'); Basicly it only "encripts" the first 5 chars of the string with the first 2 of the salt...


Leave your comment