I am new to C# just want to ask some questions.
I got a MD5 sum in C#, I should put the code in a class, but where am I going to call this method code from? ASPX, or what?. I remember that class cannot run on its own.
How to write the method to call that?
The file that i want to create a MD5 has for is a text file.
This is what I have found:
public static string CalculateMD5Hash(string strInput)
{
MD5 md5 = System.Security.Cryptography.MD5.Create();
byte[] inputBytes = System.Text.Encoding.ASCII.GetBytes(strInput);
byte[] hash = md5.ComputeHash(inputBytes);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.Length; i++)
{
sb.Append(hash[i].ToString("x2"));
}
return sb.ToString();
}