更新时间:2023-09-25 21:32:46
PHP
这PHP代码将做到:
< PHP
$海峡=admin的;
$ strUtf32 = mb_convert_encoding($海峡,UTF-32LE);
回声的MD5($ strUtf32);
>?;
这代码输出1e3fcd02b1547f847cb7fc3add4484a5
I have a hashing method in C# that looks like:
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
byte[] raw_input = Encoding.UTF32.GetBytes("hello");
byte[] raw_output = md5.ComputeHash(raw_input);
string output = "";
foreach (byte myByte in raw_output)
output += myByte.ToString("X2");
return output;
How can I implement this in PHP? Doing the following produces a different hash digest...
$output = hash('md5', 'hello');
PHP
This PHP code will do:
<?php
$str = "admin";
$strUtf32 = mb_convert_encoding($str, "UTF-32LE");
echo md5($strUtf32);
?>
This code outputs "1e3fcd02b1547f847cb7fc3add4484a5"