If you are comparing strings, use strcmp or === . People prefer === because strcmp can be confusing (it returns 0 if successful, wat).
You should use === , not == . == converts both operands to integers, if they can be interpreted as such, and since the MD5 hash does not fit into an integer, they will be truncated around half. Therefore, only the first half of the hashes should be equal. See http://phpsadness.com/sad/47 .
If you have hashed passwords, consider using a slow and strong hashing algorithm such as PBKDF2 rather than MD5.
user142019
source share