note 87248 rejected from function.md5 by danbrown
| From: | danbrown@php.net | Date: | Wed, 26 Nov 2008 15:24:00 +0000 |
| Subject: | note 87248 rejected from function.md5 by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-146985@lists.php.net to get a copy of this message | ||
Note Submitter: support at anchor dot net dot au
----
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