Currently i am doing this in my UWP app
byte[] bytes = new UTF8Encoding().GetBytes(Password);
byte[] hash = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(bytes);
string hashstring = BitConverter.ToString(hash);
I have searched a lot but couldn't find the replacement of CryptoConfig class in .NETCore.
It looks like you don't need CryptoConfig
at all. You just need MD5
:
using (var md5 = MD5.Create())
{
var hash = md5.ComputeHash(Encoding.UTF8.GetBytes(password));
return BitConverter.ToString(hash);
}
The MD5
class is present in netstandard1.3 and higher.
See more on this question at Stackoverflow