我有一个Perl脚本,我需要将其转换为PHP.
什么是Perl中md5函数的PHP模拟?
Perl脚本:
$hash = md5($str1, $str2);
PHP脚本:
$hash = md5($str1.$str2);
我在$hash中有不同的值.
如何在PHP中获得相同的$hash值?
谢谢.
解决方法:
看起来像您使用二进制格式的输出的perl版本:
http://perldoc.perl.org/Digest/MD5.html
md5($data,...)
This function will concatenate all arguments, calculate the MD5 digest
of this “message”, and return it in binary form. The returned string
will be 16 bytes long.
在PHP中试试这个:
$hash = md5($str1.$str2, true);