note 81387 deleted from function.md5 by joey
| From: | joey@php.net | Date: | Sun, 17 Jul 2011 08:40:12 +0000 |
| Subject: | note 81387 deleted from function.md5 by joey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181608@lists.php.net to get a copy of this message | ||
Note Submitter: nathan
----
I think the suggestion to double-hash your password is not a good idea. You are much much better
off adding a variable salt to passwords before hashing (such as the username or other field that is
dissimilar for every account).
Double hashing is *worse* security than a regular hash. What you're actually doing is taking
some input $passwd, converting it to a string of exactly 32 characters containing only the
characters [0-9][A-F], and then hashing *that*. You have just *greatly* increased the odds of a hash
collision (ie. the odds that I can guess a phrase that will hash to the same value as your
password).
sha1(md5($pass)) makes even less sense, since you're feeding in 128-bits of information to
generate a 256-bit hash, so 50% of the resulting data is redundant. You have not increased security
at all.
The wikipedia article linked in the last post advocates using a salt. No where (that I see) does it
advocate using the double hash approach.