Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Revision on Byte to Hexadecimal
Message
From
03/02/2014 10:21:30
 
 
To
03/02/2014 09:35:39
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01592982
Message ID:
01592997
Views:
32
What is the code of your class loMD5 ?



>From a file name, I store its MD5 value into a SQL Server Binary(16) type field.
>
>So, for a specific file, it gives:
>
>0x0DD99307B06B53520541674A00CEE11E
>
>When I use that into an application to display its value, I have to convert byte to hexadecimal. So, I use something like this:
>
>
>        ' If we cannot convert from byte to hexadecimal
>        If Not loStringFunction.ByteToHexadecimal(loMD5.oMD5) Then
>            MessageBox.Show(loStringFunction.cMessage, oApp.cTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop)
>            Exit Sub
>        End If
>
>        MessageBox.Show(loStringFunction.cString)
>
>
>loStringFunction.cString would then be equal to 0DD99307B06B53520541674A00CEE11E and I just need to add '0x' in front to obtain the same representation.
>
>But, if I use a test tool to obtain the MD5 value and store that directly into a string, without doing it from the SQL Server Binary(16) value, I end up with a longer value such as:
>
>0DD99307B06B53520541674A00CEE11E1F5F34428CC6C80E754E39560B4909EF
>
>The code is as follow:
>
>
>        ' Get the MD5
>        loMD5.cFileName = FileMD5File.Text
>        If Not loMD5.GetMD5() Then
>            MessageBox.Show(loMD5.cMessage, oApp.cTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop)
>            Exit Sub
>        End If
>
>        ' If we cannot convert from byte to hexadecimal
>        If Not loStringFunction.ByteToHexadecimal(loMD5.oMD5) Then
>            MessageBox.Show(loStringFunction.cMessage, oApp.cTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop)
>            Exit Sub
>        End If
>
>        FileMD5MD5.Text = "0x" + loStringFunction.cString
>
>
>So, it seems that if I store the MD5 value to SQL Server and take its byte value to convert it to hexadecimal, this works. But, if I take the MD5 value and convert it directly to hexadecimal, it doesn't.
>
>What am I missing?
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform