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. |