c# asp.net . I want to convert a md5 hash function to a class (.cs). how to proceed?

rystest

New member
This is my function, i never worked with classes i did some reading but couldnt figure out how to convert it.

public string GetMD5Hash(string str)
{
MD5 md5 = MD5CryptoServiceProvider.Create();
ASCIIEncoding encoding = new ASCIIEncoding();
StringBuilder sb = new StringBuilder();
byte[] stream = md5.ComputeHash(encoding.GetBytes(str));
for (int i = 0; i < stream.Length; i++)
{
sb.AppendFormat("{0:x2}", stream);
}
return sb.ToString();
}
 
Back
Top