Php enhanced mhash function implementation code

Source: Internet
Author: User
Php enhanced mhash function implementation code
This article introduces an enhanced mhash function code implemented by php. For more information, see.

The mhash function of php is used in the program. The error is: Fatal error: Call to undefined function mhash ()

The following two solutions are provided for your reference. 1. import the php_mhash.dll extension file, in addition to libmhash. dll (the load of the mhash library depends on this file), in the Apache configuration file Httpd. load LoadFile C:/php/libmhash in conf. dll ".

2. use the custom mhash enhancement function.

     $ B) {$ key = pack ('H * ', md5 ($ key);} $ key = str_pad ($ key, $ B, chr (0x00); $ ipad = str_pad ('', $ B, chr (0x36); $ opad = str_pad ('', $ B, chr (0x5c); $ k_ipad = $ key ^ $ ipad; $ k_opad = $ key ^ $ opad; return md5 ($ k_opad. pack ('H * ', md5 ($ k_ipad. $ data) ;}?>

Code description: The $ key and $ data parameters in the hmac_md5 function correspond to the original 3 and 2 parameters of mhash. Both methods can smoothly use the mhash encryption function of php.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.