If you need a random token which is more secure compared to other hash token, you can use example below.


Examples


Preferred


$size = mcrypt_get_iv_size(MCRYPT_CAST_256, MCRYPT_MODE_CFB);
$iv = mcrypt_create_iv($size, MCRYPT_DEV_RANDOM);
echo bin2hex($iv);

8a715dc6830d3de44ae3d820634a5a53

Alternative


$size = 16;
$bytes = random_bytes($size);
echo bin2hex($bytes);

a67804c9e21089e78e736dd718abe89b