MD5签名32位
//编码格式 private static string inputCharset = "utf-8"; /// <summary> /// 签名字符串 /// </summary> /// <param name="prestr">需要签名的字符串</param> /// <param name="key">密钥</param> /// <returns>签名结果</returns> public static string Sign(string prestr, string key) { StringBuilder sb = new StringBuilder(32); prestr = prestr + key; MD5 md5 = new MD5CryptoServiceProvider(); byte[] t = md5.ComputeHash(Encoding.GetEncoding(inputCharset).GetBytes(prestr)); for (int i = 0; i < t.Length; i++) { sb.Append(t[i].ToString("x").PadLeft(2, '0')); } return sb.ToString(); }