Password security

In todays world of hackers, it is very important to secure password in the database

Level 2 Encryption - md5 hashing

Level 2 encrypion is obtained by one-way encryption using md5 hashing. For example:

$password = md5($_POST["password"]);

Level 3 Encryption - Static salting

Hackers have built databases of md5 hashes of commonly used passwords. As such, using just md5 hases to secure password is not sufficient.

Static salting adds a static paraphrase in front of the users' password making it more secure. For example:

$salt = "3xCeLLen$e";
$password = md5($salt.$_POST["password"]);

Level 4 Encryption - Variable salting

If hackers are able to get a hold of your static salt then they will in turn be able to get a hold of all your week passwords.

Level 4 encryption uses a variable salt from the database to encrypt the password in place of, or in addition to the static salt. For e.g.

$salt = "3xCel@en$e!";
$password = md5(md5($row["id"]).md5($salt).md5($_POST["password"]));


In PHP5.5 you can use PHP functions password_hash() and password_verify() for securing passwords.