tonelm54
asked on
Hex to byte converter
Ive written a simple line which converts a byte array to a hex string:-
urlSafe = BitConverter.ToString(byt2 Convert).R eplace("-" , "")
However I have no idea how to convert back to a byte array? Does anyone?
I cant seem to find any example code as simple as converting it from byte to string.
Any ideas?
Thank you
urlSafe = BitConverter.ToString(byt2
However I have no idea how to convert back to a byte array? Does anyone?
I cant seem to find any example code as simple as converting it from byte to string.
Any ideas?
Thank you
Here is another similar technique that doesn't use lamba expressions
' There's no easy way to convert a hex byte string back into
' a byte array, so we have parse each byte
ReDim in_buf((message.Length \ 2) - 1)
For i As Integer = 0 To in_buf.Length - 1
in_buf(i) = Byte.Parse(message.Substring(i * 2, 2), Globalization.NumberStyles.HexNumber)
Next
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window