How to Create Password Hashing in PHP

Functions for hashing password

  • password_hash()
  • password_verify()

password_hash() –


string $password – Password provide by user

integer $algo –   Password algorithm constant(PASSWORD_DEFAULT and PASSWORD_BCRYPT)

PASSWORD_DEFAULT – uses the BCrypt algorithm to create the hash

PASSWORD_BCRYPT –  uses the CRYPT_BLOWFISH algorithm and will return a 60 character string

$options – 

$options have two indexes.One is cost and another one is salt.

Cost-  Cost is the repetition of algorithm which have default value 10.  Which means algorithm will run 10 times to make a strong hash. You can configure your cost value according to your server configuration.


Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *