J
Joshua Russell
Hi,
I'm trying to write a method that will take a string and return the 32Byte MD5 Digest (also in the form of a string).
The method I'm using is:
string MD5hash (string data)
{
// This is one implementation of the abstract class MD5.
MD5 md5 = new MD5CryptoServiceProvider();
ASCIIEncoding encoding=new ASCIIEncoding();
byte[] result = md5.ComputeHash(encoding.GetBytes(data));
string crypt = "";
for(int x = 0;x <= result.Length - 1; x++)
{
crypt += result[x];
}
return crypt;
}
The string that this method gives me is 91431072057033211115202222781313839180246. This is NOT the form I want. I'm after a string that looks like this 8f2f5a91b72102cd28355e9fc9000d6e.
Thanx Josh
I'm trying to write a method that will take a string and return the 32Byte MD5 Digest (also in the form of a string).
The method I'm using is:
string MD5hash (string data)
{
// This is one implementation of the abstract class MD5.
MD5 md5 = new MD5CryptoServiceProvider();
ASCIIEncoding encoding=new ASCIIEncoding();
byte[] result = md5.ComputeHash(encoding.GetBytes(data));
string crypt = "";
for(int x = 0;x <= result.Length - 1; x++)
{
crypt += result[x];
}
return crypt;
}
The string that this method gives me is 91431072057033211115202222781313839180246. This is NOT the form I want. I'm after a string that looks like this 8f2f5a91b72102cd28355e9fc9000d6e.
Thanx Josh