Slide 11
Slide 11 text
// Get this from in input form
$password = "annoyedkittens";
// Generate an md5 hash, use static salt
$pwhash = crypt($password, '$1$iusesalt');
echo "Password; $password\n";
echo "Password hash; $pwhash\n";
if (hash_equals($pwhash, crypt($password,'$1$iusesalt')))
echo "Password is correct\n";
else
echo "Password is incorrect\n";
// proof this works
if (hash_equals($pwhash, crypt($password,'$1$wrongsalt')))
echo "Password is correct\n";
else
echo "Password is incorrect\n";
Output:
Password; annoyedkittens
Password hash;
$1$iusesalt$J2Ll48Pfl7EgK5bN80e5P0
Password is correct
Password is incorrect
Still Wrong