Skip to content Skip to sidebar Skip to footer

What Is The Most Secure Way For Storing User's Passwords Inside Database Using Php?

Which is the most secure and most efficient way for storing passwords inside the database tables using PHP? So far I have used the md5() and the sha256 algorithm for storing passwo

Solution 1:

Bcrypt is usually considered the most secure option.

If you're using PHP 5.5 you can use the new password hashing API to make it easier to work with. There's a decent tutorial at Hashing Passwords with the PHP 5.5 Password Hashing API.

Using bcrypt is the currently accepted best practice for hashing passwords, but a large number of developers still use older and weaker algorithms like MD5 and SHA1. Some developers don’t even use a salt while hashing. The new hashing API in PHP 5.5 aims to draw attention towards bcrypt while hiding its complexity ..

Solution 2:

Using bcrypt with hash is currently the best thing to do using PHP. Don't use md5 or sha1 functions, as they are older and weaker algorithms.

Since PHP 5.5, you can use the new password_hash, password_verify, password_needs_rehash and password_get_info. You can read more about the new hashing functions here:

The password hashing API [.. makes] it easy to create and manage passwords in a secure manner.

also:

This extension is available since PHP 5.5.0 but there is also an » userland implementation for PHP >= 5.3.7.

Post a Comment for "What Is The Most Secure Way For Storing User's Passwords Inside Database Using Php?"