Método que calcula el valor hash MD5 de una cadena que se le pasa como argumento:
public String getMD5(String texto)
{
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
return encoding.GetString(md5.ComputeHash(encoding.GetBytes(texto)));
}
{
System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
System.Security.Cryptography.MD5CryptoServiceProvider md5 = new System.Security.Cryptography.MD5CryptoServiceProvider();
return encoding.GetString(md5.ComputeHash(encoding.GetBytes(texto)));
}