Comparing MD5 Hashed strings
Posted on 2004-09-10
I have some trouble comparing hashed strings between .Net and .Net Compact Framework. I used normal VB.NET to store a MD5 hashed string in a database. I used the following code to create and compare the same hash (at least, that is what i thought) using VB.NET Compact Framework (with a little help from OpenNetCF)
Dim clearBytes As [Byte]()
Dim MD5 As New MD5CryptoServiceProvider
Dim hashedText As String
Dim hashedBytes As [Byte]()
Dim str as string = "123"
clearBytes = Encoding.Unicode.GetBytes(str)
hashedBytes = MD5.ComputeHash(clearBytes)
hashedText = BitConverter.ToString(hashedBytes)
This produces the following Hash:
If I compare this to the same Hash i did with VB.NET (Using standard .Net Crypto Provider):
there is a difference.
Does anyone know how to fix this issue?