How To Save and Verify Password Using PHP and MySQL

Use password_hash() and password_verify() function.

Bharathiraja
CodeX

--

Photo by Ben on Unsplash

In this tutorial, you will learn how to save the password and verify the saved password using PHP and MySQL. At the beginning of the software applications, developers saved the password as plain text in the database table. When the database is hacked by hackers, they are able to view the passwords of the individual account. This causes a big problem for the organisations. To avoid this problem, the developer community recommended saving the password in an encrypted format in the table.

One-Way Hashing:

There are many recommendations available on the internet to store the passwords in the table. The best and recommended approach is using the password hashing technique( Especially one-way password hashing).

The one-way hashing function is nothing but a mathematical function. It takes a password as input and will generate a fixed-length binary code like hex codes. It is very difficult to revert. It means we can not unpack the password from the hex code.

--

--

Bharathiraja
CodeX
Writer for

AWS | DevOps | Kubernetes | Terraform| Angular | Deep&Machine Learning, Ionic, Full Stack Developer. Learn more at https://github.com/bharathirajatut