I’m using crypt as follows:
$pass = crypt($pass, 'd4');
for both insertion and validation of a password against a mysql table. Problem is that if the passwords are similar it generates a similar result. Is there an algorithm that guarantees different results for different passwords?
Use
hash()and choose hashing algorithm that suits you well (if possible something stronger than MD5, but don’t go all the way to SHA512 either)On
crypt()‘s manual page you will find this:which should explain why you get same results.