md5 hashses

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
 
L

Lee Atkinson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top