Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Secure password storage

I'm developing a web service where users must login. I will store user data in an SQL database and input/output via PHP. But I don't want to store it openly. How do I encrypt the passwords in PHP so only those who knows the password can unlock it?

I know services like phpBB uses some sort of hiding/encryption on stored passwords.

like image 752
Espen Avatar asked Sep 28 '26 15:09

Espen


1 Answers

You need to salt and hash the password, using an appropriately secure algorithm.

  • PHP's mhash has appropriate hashing functions
  • A full example here on SO
like image 187
El Yobo Avatar answered Oct 01 '26 04:10

El Yobo