note 61790 added to security.database.storage
| From: | Fairydaveatthelocationofdodo dot com dot au at osu1 dot php dot net | Date: | Sun, 12 Feb 2006 02:58:15 +0000 |
| Subject: | note 61790 added to security.database.storage | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-103538@lists.php.net to get a copy of this message | ||
I think the best way to have a salt is not to randomly generate one or store a fixed one. Often more
than just a password is saved, so use the extra data. Use things like the username, signup date,
user ID, anything which is saved in the same table. That way you save on space used by not storing
the salt for each user.
Although your method can always be broken if the hacker gets access to your database AND your file,
you can make it more difficult. Use different user data depending on random things, the code
doesn't need to make sense, just produce the same result each time. For example:
if ((asc(username character 5) > asc(username character 2))
{
if (month the account created > 6)
salt = ddmmyyyy of account created date
else
salt = yyyyddmm of account created date
}
else
{
if (day of account created > 15)
salt = user id * asc(username character 3)
else
salt = user id + asc(username character 1) + asc(username character 4)
}
This wont prevent them from reading passwords when they have both database and file access, but it
will confuse them and slow them up without much more processing power required to create a random
salt
----
Server IP: 64.246.30.37
Probable Submitter: 220.240.223.112
----
Manual Page -- http://www.php.net/manual/en/security.database.storage.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61790
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61790&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61790&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61790&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61790&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61790&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61790&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61790&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61790&report=yes
Search -- http://master.php.net/manage/user-notes.php