crypt () uses any basic hash function used by the OS, so if you want reliable (consistent) results, you can use one of the other hash functions, such as md5 () or sha256 (), sha512 () .
If you want crypt () to use the special hash function , you need to specify a hash parameter and check if the algorithm is supported on the host OS. For example (taken from the PHP Manual page crypt () ):
if (CRYPT_STD_DES == 1) {
echo 'Standard DES: ' . crypt('rasmuslerdorf', 'rl') . "\n";
}
But its a very dependent OS, so I recommend using a standalone hash function. Or hash () .
Append:
() hash_algos(), , , , :
<?php
$algos = hash_algos();
if (in_array("sha256", $algos)) {
$pass = hash ("sha256", "userpassword" . "salt");
}
?>
, .