我有一个Perl脚本,我需要将其转换为PHP.什么是md5
Perl中函数的PHP模拟?
Perl脚本:
$hash = md5($str1, $str2);
Run Code Online (Sandbox Code Playgroud)
PHP脚本:
$hash = md5($str1.$str2);
Run Code Online (Sandbox Code Playgroud)
我有不同的价值观$hash
.我如何$hash
在PHP中获得相同的价值?
谢谢.
看起来像您使用二进制格式的输出的perl版本:
http://perldoc.perl.org/Digest/MD5.html
md5($data,...)
Run Code Online (Sandbox Code Playgroud)
此函数将连接所有参数,计算此"消息"的MD5摘要,并以二进制形式返回.返回的字符串长度为16个字节.
在PHP中试试这个:
$hash = md5($str1.$str2, true);
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请参阅php 文档.