hash('sha512', $_POST['password'] . time())
I have heard alot of things about this and that and can't come to a conclusion...
hash('sha512', $_POST['password'] . time())
I have heard alot of things about this and that and can't come to a conclusion...
I suggest added a salt when creating and hashing passwords, other then that - yes.
You're using time()
as a salt. You can do that, but don't forget to store it (otherwise, how would you ever be able to check that the given password concatenated with the salt matches the stored hash?). sha512
is a great choice for a hash algorithm. I'd suggest
$salt = uniqid('carlgcoder_') . microtime(true);
$hash = hash('sha512', $salt . $_POST['password']);
Use salt. Sample:
<?php
$passwordWasSavedInDB = md5($_POST['password']."_paranoia_")