md5 hashses

  • Thread starter Thread starter Lee Atkinson
  • Start date Start date
L

Lee Atkinson

HI guys,

Im having trouble replicating the format of a MD5 hashed list of passwords
ive been sent from a client .... They all appear to be in this kind of
format - "d41d8cd98f00b204e9800998ecf8427e"

However when I try to hash some clear text passwords using something like
this -

byte[] pass = Encoding.UTF8.GetBytes(cleartextpassword);
MD5 md5 = new MD5CryptoServiceProvider();
string strPassword = Encoding.UTF8.GetString(md5.ComputeHash(pass));
return strPassword;

The format comes up with all kinds of usual characters, not just alpha
numeric like the list provided, Also tried converting to base64 but that's
not right either.

I finally looked at -
System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("
password", "MD5"))

Which produces the right format but I cant find any code to see whats going
on behind the scenes with this.... Any one got any ideas how this is
generated?

Cheers
Lee
 
Ah... Ive found the function to format it -

Function byteArrayToHexString(ByVal a) As String
Dim r, b, i
r = ""
For i = 0 To UBound(a)
b = Hex((a(i) And &HF0) / 16) & Hex(a(i) And &HF)
r = r & b
Next
byteArrayToHexString = r
End Function
 
Back
Top