note 28002 deleted from function.crypt by aidan

From: Date: Mon, 05 Jul 2004 10:26:45 +0000
Subject: note 28002 deleted from function.crypt by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-72579@lists.php.net to get a copy of this message
Note Submitter: simon [DOT] taghioff [AT] btinternet.com ---- in response to manfire at softhome dot net: crypt() generates a string which is 34 characters in length. It sounds like you specified a database field which was only 30 characters in length. So while crypt() generated all 34 characters, it only stored 30 in your database, causing problems when you compared the two strings. Here is full sample code for generating and verifying a password: $mypasswd = "gadget"; $hashed = crypt($mypasswd); $chkpass = crypt($mypasswd, $hashed); if ($hashed == $chkpass) { echo "password verified"; } else { echo "password invalid"; };

« previous php.notes (#72579) next »