Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MD5 encryption returns different value on compact framework

Status
Not open for further replies.

jcaulder

Programmer
Apr 22, 2002
241
0
0
US
I have code that encrypts a user password and stores in a database. The initial insertion occurs using a desktop application running full 2.0 .Net framework. When the user attempts to log in on a handheld device running the compact framework, I use the same code to take the supplied user password and encrypt it. I then compare that value to the database stored value and they don't match. Can anyone assist in telling me what to change to resolve this? I thought it was the encoding but no combination works to fix this. It is and always has been using ASCII encoding. The code is below:


Function EncryptToMD5String(ByVal SourceText As String) As String

'Create an encoding object to ensure the encoding standard for the source text
Dim Ue As New System.Text.ASCIIEncoding
'Retrieve a byte array based on the source text
Dim ByteSourceText() As Byte = Ue.GetBytes(SourceText)
'Instantiate an MD5 Provider object
Dim Md5 As New MD5CryptoServiceProvider
'Compute the hash value from the source
Dim ByteHash() As Byte = Md5.ComputeHash(ByteSourceText)
'And convert it to String format for return
Return Convert.ToBase64String(ByteHash)

End Function

Thanks!
 
Just for clarification, the desktop application generates the following value:

IctSnx399ivl5GGB1Sub9g==

The compact framework generates this:

/CrhsbWmX7UNQCDpGpdcug==

The text being encrypted is: cjones7308

TIA!
 
Disregard the post. The information provided to me and posted was inaccurate.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top