note 99843 deleted from function.mhash by danbrown
| From: | danbrown@php.net | Date: | Fri, 10 Sep 2010 15:00:13 +0000 |
| Subject: | note 99843 deleted from function.mhash by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-172448@lists.php.net to get a copy of this message | ||
Note Submitter: makfruit
----
---Quote---
Easier way:
md5($str, true) == mhash(MHASH_MD5, $str)
sha1($str, true) == mhash(MHASH_SHA1, $str)
---/Quote---
Actually, mhash is often used to generate a keyed hash value. So 'md5($str, true)' is not
a good decision. Instead of this, you can use hash_hmac:
hash_hmac("md5", $str, $key, true)
which is an equivalent for
mhash(MHASH_MD5, $str, $key).