note 54608 added to security.database.storage
| From: | Jeff at osu1 dot php dot net | Date: | Sat, 09 Jul 2005 03:03:57 +0000 |
| Subject: | note 54608 added to security.database.storage | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91706@lists.php.net to get a copy of this message | ||
MD5 is decent and has been around for a while, but SHA-256, 384, 512, and to a lesser degree,
SHA-1(160) are more secure.
My best advice is to be creative. Make it so that if the digests/hashes are stolen, then it's
difficult to reverse engineer it, both computationally difficult and tough enough that a user
can't use a readily-availible program to brute force an MD5 hash. (such as md5brute.exe)
Try using combinations to make a unique digest, like:
SHA512(SHA512(SHA512(MD5(password + random_salt + "SALT1") + "SALT2" +
MD5(random_salt))))
Now of course the more complicated it is, the slower it will run and the tougher it will be for you
to troubleshoot it until it's foolproof, but it will be far harder for an attacker. Also note
that a random salt must be recorded with the digest.
The point is that if just 1 or just 2 of the parts (algorithm, hashes, random salts) are recovered,
nothing can be done. If all 3 are recovered, then the person will still have to analyze the code,
make their own program (can't just download something), and wait for it to bruteforce it. If
all 3 parts are stored separately, it is far more difficult.
A simple MD5 hash can be broken in minutes or hours, but something more complex will give an
attacker a very cold shoulder, and he will see that as a clue that you are not an easy target.
----
Manual Page -- http://www.php.net/manual/en/security.database.storage.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54608
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54608&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54608&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54608&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54608&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54608&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54608&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54608&report=yes
Search -- http://master.php.net/manage/user-notes.php