note 87248 added to function.md5
| From: | support at anchor dot net dot au | Date: | Wed, 26 Nov 2008 15:18:14 +0000 |
| Subject: | note 87248 added to function.md5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-146984@lists.php.net to get a copy of this message | ||
Please stop trying to make "more secure" hashes, there are some terrible suggestions here.
There is a correct way to do it, it's called "HMAC". This is a well-defined way of
mixing salt and message data in an attack-resistant manner.
If you're using PHP 5.1.2 or greater (which you should be by now):
<?php
$hash = hash_hmac("md5", $password, $salt);
?>
As documented, you can also choose SHA, Haval, etc. for your hash function.
If hash_hmac() isn't available then you can use a pure PHP implementation as described in an
old comment on this page by mina86 at tlen dot pl:
http://au.php.net/manual/en/function.md5.php#56934
----
Server IP: 203.88.112.190
Probable Submitter: 121.44.160.250
----
Manual Page -- http://www.php.net/manual/en/function.md5.php
Edit -- https://master.php.net/note/edit/87248
Del: integrated -- https://master.php.net/note/delete/87248/integrated
Del: useless -- https://master.php.net/note/delete/87248/useless
Del: bad code -- https://master.php.net/note/delete/87248/bad+code
Del: spam -- https://master.php.net/note/delete/87248/spam
Del: non-english -- https://master.php.net/note/delete/87248/non-english
Del: in docs -- https://master.php.net/note/delete/87248/in+docs
Del: other reasons-- https://master.php.net/note/delete/87248
Reject -- https://master.php.net/note/reject/87248
Search -- https://master.php.net/manage/user-notes.php