.netcore中加密型类别的替换是什么?



当前我正在我的UWP应用程序

byte[] bytes = new UTF8Encoding().GetBytes(Password);
byte[] hash = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(bytes);
string hashstring = BitConverter.ToString(hash);

我已经搜索了很多

看起来您根本不需要CryptoConfig。您只需要MD5

using (var md5 = MD5.Create())
{
    var hash = md5.ComputeHash(Encoding.UTF8.GetBytes(password));
    return BitConverter.ToString(hash);
}

MD5类中存在于NetStandard1.3及更高。

最新更新