I'm using PHP V5.6.16
I'm having this error while trying to create an access token
crypt(): No salt parameter was specified. You must use a randomly generated salt and a strong hash function to produce a secure hash
This is the function I'm using.
/**
* Generate a token
* @return string token
*/
private function getToken()
{
$random_id_length = 15;
//generate a random id encrypt it and store it in $rnd_id
$rnd_id = crypt(uniqid(rand(), CRYPT_EXT_DES));
//to remove any slashes that might have come
$rnd_id = strip_tags(stripslashes($rnd_id));
//Removing any . or / and reversing the string
$rnd_id = str_replace(".", "", $rnd_id);
$rnd_id = strrev(str_replace("/", "", $rnd_id));
//finally I take the first 10 characters from the $rnd_id
$rnd_id = substr($rnd_id, 0, $random_id_length);
return urldecode($rnd_id);
}
How to fix it?