md5 16位二进制与32位字符串相互转换示例
程序员文章站
2023-12-04 08:25:16
复制代码 代码如下:
<?php
复制代码 代码如下:
<?php
$str = 'test';
$cm = md5($str);
$bm = md5($str, true);
$cstr = implode(unpack('h*', $bm));
$bstr = pack('h*', $cm);
echo 'str:'. $str . "<br >\n";
echo 'cm :' . $cm . "<br >\n";
echo 'cstr:' . $cstr . "<br >\n";
echo 'urlencode(bm) :' . urlencode($bm) . "<br >\n";
echo 'urlencode(bstr):' . urlencode($bstr) . "<br >\n";