String inputString = "要处理的字符串";
MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
byte[] data = System.Text.Encoding.UTF8.GetBytes(inputString);
byte[] md5Data = md5.ComputeHash(data, 0, data.Length);
md5.Clear();
String resule= String.Empty;
for (int i = 0; i < md5Data.Length; i++)
{
    resule += System.Convert.ToString(md5Data[i], 16).PadLeft(2, '0');
}
resule= resule.PadLeft(32, '0');

MessageBox.Show(resule);

标签: none

添加新评论