bytes to hex characters



Here is the code:
For intIndex = 1 To Len(outputhex) Step 2
j = CByte("&H" & Mid(outputhex, intIndex, 2))
ch = Convert.ToChar(j)
file.Write(ch)
Next
Hi,
I have a related problem:
getting an MD5 string.

There are a few md5 databases e.g. http://md5.rednoize.com which return
the md5 hashes of your input strings. Can this be done by some type
conversion?
I tried the following but cannot get the type converstion right:

Public Function MD5String(vData As String) As String
Dim DBytes(vData.Length) As Byte, i As Integer
For i = 0 To vData.Length - 1
DBytes(i) = Convert.ToByte(Convert.ToChar(vData.Substring(i, 1)))
Next
Dim md5 As New MD5CryptoServiceProvider()
Dim HBytes As Byte() = md5.computeHash(DBytes)
Dim retstr As String
retstr = ""
For i = 0 To HBytes.Length - 1
Dim zero as integer = 0
'retstr &= Convert.ToString(Convert.ToChar(HBytes(i)))
retstr &= Convert.toString(zero Or HBytes(i))
Next
Return retstr
End Function

This should be simple but I've spent a lot of time going through SDK
docs but to no good.

TIA,
JS

.



Relevant Pages

  • MD5 erzeugen
    ... Public Function GenerateHash(ByVal sourceText As String) As String ... Dim md5 As New MD5CryptoServiceProvider ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • MD5
    ... Public Function GenerateHash(ByVal sourceText As String) As String ... Dim md5 As New MD5CryptoServiceProvider ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: MD5
    ... Public Function GenerateHash(ByVal sourceText As String) As String Dim md5 As New MD5CryptoServiceProvider ...
    (microsoft.public.de.german.entwickler.dotnet.vb)
  • Re: Browse for folder - Jim Rechs
    ... I've never been successful setting the root to anything other than a drive's ... pszDisplayName As String ... If RetStr "" Then MsgBox RetStr ... Dim bInfo As BROWSEINFO ...
    (microsoft.public.excel.programming)
  • Re: bytes to hex characters
    ... common md5 databases give different results: ... Public Function MD5String(vData As String) As String ... Dim DBytesAs Byte, i As Integer ... Dim retstr As String ...
    (microsoft.public.dotnet.languages.vb)