I'm trying to make a more or less secure login system for my site, I haven't had much time with securing things so I'm learning as I go along. Wanted to hear some views on which of the following is better and why. (or have I made a mistake somewhere?)
$staticsalt = '$%*#)$*)^A#$#543667ggfdf\#$%x';
$random = md5(uniqid(mt_rand(), true));
$salt = hash('sha512',$random.$_POST['password'].microtime().$staticsalt);
either (where having the $salt in the database won't be necessary...)
$password = crypt($_POST['password'], '$2a$12$'.$salt);
or (where I would need the $salt in the database also...)
$password = hash('sha512',$salt.$_POST['password']);