Enviroment
- .NET Core 2.1
References
Step
To acheive the encryption purpose, all we need to do is copy&paste. Usage is written in the MSDN page I posted above.
public class Encryption {
private MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
public string Encrypt(string key)
{
byte[] data = md5.ComputeHash(Encoding.Default.GetBytes(key));
StringBuilder sBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
sBuilder.Append(data[i].ToString("x2"));
}
return sBuilder.ToString();
}
}
I wrote it as a standalone module in my project, it's easier to modify/add things in the future.
