So a couple years ago when I was learning basic back-end web development, I found a tutorial for creating a basic log in system. I haven't done much modification to the code since, but I have the opportunity now to use a more robust system if I need to.
So here's the code I'm currently using:
$pepper = "String of 24 random characters";
$salt = dechex(mt_rand(0, 2147483647)) . dechex(mt_rand(0, 2147483647));
$loopcount = 97674;
for($i = 0; $i < $loopcount; $i++){
$value = hash("sha256", $value . $salt . $pepper);
}
return $value;
Basically, a static 24-character pepper, a salt, and the password are hashed 90,000+ times. It's probably also worth mentioning that the salt is stored in the database.
My biggest question is if hashing it that many times actually does anything. I also want to know if the salt and pepper are strong enough.