note 81388 added to function.sha1
| From: | nathan at osu1 dot php dot net | Date: | Tue, 26 Feb 2008 04:11:38 +0000 |
| Subject: | note 81388 added to function.sha1 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136487@lists.php.net to get a copy of this message | ||
The suggestion below 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.
----
Server IP: 208.69.120.35
Probable Submitter: 207.162.210.145
----
Manual Page -- http://www.php.net/manual/en/function.sha1.php
Edit -- https://master.php.net/note/edit/81388
Del: integrated -- https://master.php.net/note/delete/81388/integrated
Del: useless -- https://master.php.net/note/delete/81388/useless
Del: bad code -- https://master.php.net/note/delete/81388/bad+code
Del: spam -- https://master.php.net/note/delete/81388/spam
Del: non-english -- https://master.php.net/note/delete/81388/non-english
Del: in docs -- https://master.php.net/note/delete/81388/in+docs
Del: other reasons-- https://master.php.net/note/delete/81388
Reject -- https://master.php.net/note/reject/81388
Search -- https://master.php.net/manage/user-notes.php