php 代码
$input='中国'; $result= md5($input); $temp=iconv("UTF-8", "UTF16LE", $input); echo md5($temp)
c#
var resultUnicode32 = GetMD5(input, Encoding.Unicode, 32); public static String GetMD5(string s, Encoding charset, int bit) { String md5Value = string.Empty; if ((bit == 0x10) || (bit == 0x20)) { byte[] t = new MD5CryptoServiceProvider().ComputeHash(charset.GetBytes(s)); StringBuilder sb = new StringBuilder(); for (int i = 0; i < t.Length; i++) { sb.Append(t[i].ToString("x").PadLeft(2, '0')); } md5Value = sb.ToString().ToLower(); } if (bit == 0x10) { return md5Value.Substring(8, 0x10); } return md5Value; }