MD5 加密

8/3/2015来源:C#应用人气:2184

md5 加密

/// <summary>/// MD5加密/// </summary>/// <param name="value">需要加密的值</param>/// <param name="pwSalt">附加值</param>/// <returns></returns>public static string GetMD5(string value, string pwSalt){HashAlgorithm hashAlgorithm = new MD5CryptoServicePRovider(); // or SHA1CryptoServiceProvider();byte[] result = hashAlgorithm.ComputeHash(Encoding.UTF8.GetBytes(pwSalt+value));StringBuilder sBuilder = new StringBuilder();for (int i = 0; i < result.Length; i++){sBuilder.Append(result[i].ToString("x2"));}return sBuilder.ToString();}