note 47761 added to function.crypt
| From: | geniusatclan-aftershockdotcom at osu1 dot php dot net | Date: | Mon, 29 Nov 2004 01:10:28 +0000 |
| Subject: | note 47761 added to function.crypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-81130@lists.php.net to get a copy of this message | ||
I discovered in the script stated before, when using a salt string the passwords length cannot be
longer than 8 characters. However, when not using a salt string, it can exceded that limit.
Modified Example from athony, not using the salt.
<?php
$password = "qwertyuiopasdfghjkl";
// Not using any salts
$encrypted = crypt($password);
// Now do the comparison
$shortPass = substr($password, 0, 8);
if (crypt( $shortPass, $encrypted ) == $encrypted )
echo "The passwords match";
else
echo "The passwords do not match";
?>
This will print: "The passwords do not match"
The check for password would still work if it was correct. Just by shortening the password string to
eight, or extending the substr, or decalring the shortpass the same as the pass, it would be:
"The passwords do match"
So the eight letter limit only works when using a salt.
----
Manual Page -- http://www.php.net/manual/en/function.crypt.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+47761
Delete -- http://master.php.net/manage/user-notes.php?action=delete+47761&report=yes
Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47761&report=yes&reason=bad+code
Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47761&report=yes&reason=spam
Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47761&report=yes&reason=useless+example
Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47761&report=yes&reason=contains+commercial+links
Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47761&report=yes&reason=useless+note
Reject -- http://master.php.net/manage/user-notes.php?action=reject+47761&report=yes
Search -- http://master.php.net/manage/user-notes.php