crypt() function in php || PHP crypt function

crypt() function in php


PHP crypt() function is used to get a hashed string corresponding to the string. It is an inbuilt function of PHP.

This function uses different crypt ion algorithms on the basis of the user's machine and accordingly produces different results. This function uses only a one-way cryption algorithm. The return type of this function is string means it returns an encoded string.


crypt($strng, $salt);


  • $string is a PHP string that converts into a hashed string by this function. It is mandatory.
  • $salt is also a PHP string that is used to generate strong passwords and it works as the base of hashing. Although it is optional for better security it should be declared.


echo "Hashed string is : $hashed_string";


Best WordPress Hosting


Discount Coupons

Get a .COM for just $6.98

Secure Domain for a Mini Price

Leave a Reply

    Waiting for your comments