PHP crypt() function is often used for one-way string encryption using DES or MD5 algorithms (or hashing). The standard DES-based crypt() returns the salt as the first two characters of the output. The follwing constant are used with the crypt() function:
On systems where above function supports multiple hash types, the constants above are set to 0 or 1 depending on whether the above types is available.
Syntax
Parameter | Description |
---|---|
str : | Required parameter. The string to be hashed. |
salt : | Optional parameter. An salt string to base the hashing on. |
Return Value : | Returns the hashed string or a string that is shorter than 13 characters and is guaranteed to differ from the salt on failure. |