I understand and recognize that storing passwords in my own database is a massive security hole compared to using services like Google or Facebook, but I was wondering if the following code could be used to securely store usernames and passwords using a salted hash:
$username = $_POST['user']
$salt = md5(openssl_random_psuedo_bytes(24, true));
$pass = sha1($salt.$_POST['pass'])
I believe it's fairly secure, but I'm no expert.
EDIT:
I think this would be better, would it?
$salt1 = md5(sha1(openssl_random_psuedo_bytes(32, true));
$pass = password_hash($_POST['pass'] . $salt1, PASSWORD_BCRYPT);
Am I any closer to finding a decent mechanism for storing passwords?