The code used was pulled directly from MS articles.
They do indeed produce different results. In fact the first function
returns a string with a hyphen at every two characters, eg: ab-cd-ef- etc.
The 2nd function does not have hyphens in the result and the letter don't
match so replacing hyphens with "" still does not produce the same result.
wr
Hi,
The reason you results do not match is that you are passing a unicode string
to the MD5 algoritm and the HashPasswordForStoringInConfigFile is using the
UTF8 encoding of the passed string to perform the MD5 hash.
Hope this helps

Signature
Chris Taylor
http://dotnetjunkies.com/weblog/chris.taylor
> The code used was pulled directly from MS articles.
>
[quoted text clipped - 28 lines]
> > Console.WriteLine("Algorithm: {0}", result.ToString());
> > Console.WriteLine("Forms Auth: {0}",
FormsAuthentication.HashPasswordForStoringInConfigFile(text,
> > "md5"));
> > }
[quoted text clipped - 33 lines]
> > >>
> > >> Dim dataToHash As [Byte]() = ConvertStringToByteArray(strPasswordClear) Dim hashvalue As Byte() =
CType(CryptoConfig.CreateFromName("MD5"),
HashAlgorithm).ComputeHash(dataToHash)
> > >> Return BitConverter.ToString(hashvalue)
> > >>
[quoted text clipped - 7 lines]
> > >> --
> > >> wr
Matt Berther - 15 Jan 2005 18:10 GMT
Hello Chris,
You're right... I completely missed that. The code I posted was using Encoding.UTF8,
so I didnt even think about that. ;)
--
Matt Berther
http://www.mattberther.com
> Hi,
>
[quoted text clipped - 4 lines]
>
> Hope this helps
Hello WhiskyRomeo,
Right, notice the sample code I gave uses the byte.ToString("x2"). This means
to create the hex value. Also, notice Im doing a ToUpper() on each.
The code that I posted creates the same hash...
--
Matt Berther
http://www.mattberther.com
> The code used was pulled directly from MS articles.
>
[quoted text clipped - 77 lines]
>>>> --
>>>> wr
WhiskyRomeo - 16 Jan 2005 16:25 GMT
Matt, Chris,
Thanks again, I see the problem now. This has been very educational.
wr
> Hello WhiskyRomeo,
>
[quoted text clipped - 88 lines]
> >>>> --
> >>>> wr