Ho creato la funzione qui sotto per creare un hash lungo 64 caratteri completamente casuale
function password_salt($password){
$salt = hash("sha512", mt_rand(1,100000) . strtotime("now") . $password . "ewuwmeqwjkeq 7689" . hash("sha256", strtotime("now - 10 days") . $password));
$salt = $salt . $password;
for ($i=0;$i<10000;$i++){
$salt = hash("sha512",$salt);
}
$hash = $salt . $password;
for ($i=0;$i<10000;$i++){
$hash = hash("sha512",$hash);
}
$salt = hash("sha512", mt_rand(1,100000) . strtotime("now") . $password . $hash . "ewuwmeqwjkeq 7689" . hash("sha256", strtotime("now - 10 days") . $hash . $salt) . $salt);
//salt is almost ready for production
// go salt part 2
$salt2 = hash("sha512", $salt . $salt . $salt . $password . mt_rand(1,100000) . "dsjdj3y87Yhuu(&^TYUGh" . hash("sha512", $salt . $salt . $password . $salt));
//hash salt . salt2 . salt . salt2 . salt2 . hash salt2 timestamp
$salt = hash("sha512", $salt . $salt2 . uniqid(rand(), true) . $salt . $salt2 . $salt2 . hash("sha512", $salt2 . strtotime("now")));
// go salt 3
$salt3 = hash("sha512", $salt2 . $salt . $salt2 . $password . mt_rand(1,100000) . "DMDJ3908_))O l;[h" . hash("sha512", $salt . $salt2 . $password . $salt2));
//final salt
$salt = hash("sha512", $salt3 . $salt2 . $salt . $salt2 . $salt3 . hash("sha512", $salt3 . strtotime("now - 1 day") . uniqid(rand(), true)) . uniqid(rand(), true));
echo "Salt: ". $salt . "<br><br>";
}
Questa funzione è abbastanza buona da rendere salato sicuro?