bytes to hex characters
- From: "Joseph S." <js_dev@xxxxxxxxxxxxxx>
- Date: 17 May 2006 03:28:59 -0700
Here is the code:Hi,
For intIndex = 1 To Len(outputhex) Step 2
j = CByte("&H" & Mid(outputhex, intIndex, 2))
ch = Convert.ToChar(j)
file.Write(ch)
Next
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
.
- Follow-Ups:
- Re: bytes to hex characters
- From: Joseph S.
- Re: bytes to hex characters
- Prev by Date: Re: DataView RowFiltering
- Next by Date: Re: How to pass commands to Windows Service
- Previous by thread: How to pass commands to Windows Service
- Next by thread: Re: bytes to hex characters
- Index(es):
Relevant Pages
|