vendredi 22 juillet 2016

PHP Issue: password_hash function is not able to generate a salt

I am creating a user registration service provider and in that I am using the password_hash function in order to hash the provided user's password. Below is the code portion used in order to create the hashed string:

public function generateHash($string)
    {
        return password_hash($string, PASSWORD_BCRYPT);
    }

As I understood from the PHP manual, we should not generate our salt and instead let the password_hash function take care of that for improved security. However, when I try to create a new user I get the below warning:

Warning: password_hash(): Unable to generate salt

The application creates the user but due to the above issue no hash will be generated and the password will always be blank in the database

I am using PHP version 7.0.4/Zend Server in my development environment

It would be highly appreciated if someone can point me in the right direction

Aucun commentaire:

Enregistrer un commentaire