我有一个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);
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。