Tsallaka zuwa abun ciki
Justice Tech School

Password Hashing

password_hash makes a salted hash and password_verify checks it. Never store plain passwords.

Example
$h = password_hash("secret", PASSWORD_DEFAULT);
var_dump(password_verify("secret", $h), password_verify("wrong", $h));

Result

bool(true)
bool(false)

Exercise

Check a password.

("secret", $h)

Quiz Test

Should you store md5 passwords?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.