C# md5 System.Security.Cryptography.MD5CryptoServiceProvider过时

//原来方法
System.Security.Cryptography.MD5CryptoServiceProvider md5Hasher = new System.Security.Cryptography.MD5CryptoServiceProvider();
//新版方法
MD5 md5Hasher = MD5.Create();
byte[] data = md5Hasher .ComputeHash(Encoding.Default.GetBytes(input));
StringBuilder sBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
    sBuilder.Append(data[i].ToString("x2"));
}
if (isUpper)
{
    return sBuilder.ToString().ToUpper();
}
return sBuilder.ToString();

你可能感兴趣的:(dotnet,c#,java,开发语言)