note 54608 deleted from security.database.storage by bjori
| From: | bjori@php.net | Date: | Wed, 12 Apr 2006 14:56:57 +0000 |
| Subject: | note 54608 deleted from security.database.storage by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-107884@lists.php.net to get a copy of this message | ||
Note Submitter: Jeff
----
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.