The crypt () function is used to create one-way encryption. It takes one input string and one optional parameter. The function is defined as:

crypt ($input_string, $salt)

Here, $input_string consists of the input string that has to be encrypted and $salt is also a string parameter that is used to generate a strong password and it acts as the base of the hashing process here. PHP uses DES for encryption. The format is as follows:

<?php
$pass = crypt(“MyPass”);
echo “Encrypted version of your selected password is “.$pass;
?>