C# MD5 应用
- public String md5(String s)
- {
- System.Security.Cryptography.MD5 md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
- byte[] bytes = System.Text.Encoding.UTF8.GetBytes(s);
- bytes = md5.ComputeHash(bytes);
- md5.Clear();
- string ret = "";
- for (int i = 0; i < bytes.Length; i++)
- {
- ret += Convert.ToString(bytes[i], 16).PadLeft(2, '0');
- }
- return ret.PadLeft(32, '0');
- }