Tuesday, December 16, 2008

MD5 C#.NET hash funciton

public static string Md5(string strChange)
{
//Declarations
Byte[] originalBytes;
Byte[] encodedBytes;
MD5 md5;

md5 = new MD5CryptoServiceProvider();
originalBytes = ASCIIEncoding.Default.GetBytes(strChange);
encodedBytes = md5.ComputeHash(originalBytes);



//Convert encoded bytes back to a 'readable' string

string result = BitConverter.ToString(encodedBytes);
return result;

}

No comments:

Post a Comment