Forum Moderators: phranque
https good enough for a login system?Yes
At this time, if your new project can afford to require PHP 5.5+, which it should, please use PHP's native password_hash() / password_verify() API instead of phpass
Nothing much I can do if someone is listening in on me but no money is involved with the communications and nothing of a national security interest, but I do like privacy.
$password='changeme';
$options = [
//'salt' => uniqid(mt_rand(), true) //write your own code to generate a suitable salt
'cost' => 12 // the default cost is 10
];
$hash = password_hash($password, PASSWORD_DEFAULT, $options);
echo"$hash ";
if (password_verify($password, $hash)) {
echo" Success!";
}
else {
echo" Invalid credentials ";
} Warning The salt option has been deprecated as of PHP 7.0.0. It is now preferred to simply use the salt that is generated by default.