我在C#中有一个哈希方法,看起来像:
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;
Run Code Online (Sandbox Code Playgroud)
我怎样才能在PHP中实现它?执行以下操作会生成不同的哈希摘要...
$output = hash('md5', 'hello');
Run Code Online (Sandbox Code Playgroud)