note 53593 added to function.crypt
| From: | ceo at l-i-e dot com | Date: | Tue, 07 Jun 2005 01:03:00 +0000 |
| Subject: | note 53593 added to function.crypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90030@lists.php.net to get a copy of this message | ||
The people confused about the first 2 characters of the plain-text password being used as the salt
are... confused.
AFTER you crypt() your plain-text password, with 2 RANDOM characters, the RESULTING scrambled output
with have the 2 randomly-selected characters as its first 2 characters.
Later, to check a password presented by the user, you use the first 2 characters of the SCRAMBLED
password as the salt.
So you do not need to remember the salt elsewhere -- it is buried in the encrypted output.
This is by design by very very very clever cryptologists, and in no way, shape, or form decreases
the "security" of the algorithm.
The same is true of all the encryption algorithms here -- The salt may be 27 characters long, and
embedded in the middle of the crypted string, but it's still there, and that's Good.
I hope this note decreases the confusion caused by the 2 early notes discussing salt.
----
Manual Page -- http://www.php.net/manual/en/function.crypt.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53593
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53593&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53593&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53593&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53593&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53593&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53593&report=yes
Search -- http://master.php.net/manage/user-notes.php