I'm building a site that has users on them, and as with most sites housing some user-type system, they sign in with their e-mails and passwords. I'm using PHP for the back-end portion of my site.
After reading up some articles and posts on the Internet, I learned of the PHP functions password_hash() and password_verify() and wanted to know if an example procedure such as this one was secure enough?
- Register the user, password_hash() their password and store the hash in the database.
- When logging in, use password_verify() to verify the password and log them in.
- If they want to change their password, get their input and password_hash() the input again.
So the questions I have with this are as follows:
- Are password_hash() and password_verify() the only functions I need?
- Can I take raw user input and safely hash a password using password_hash() for storage in a database?
Any answers would be greatly be appreciated. Thank you.