Hex to Binary Conversion

S

Stephen

Hello all.

I have some LONG hex strings (between 20 and 40 bytes) that I would like to
convert to binary. I have found a few options but they only allow for short
hex strings, the ones I have are pretty long. Thanks for any help/tips.
 
S

Stephen

I could do that but for simplicity I was looking for a soultion to do the
entire string at once.
 
J

Jonathan Wood

Just parse the string. Convert each digit to it's value ('0' = 0, '1' = 1,
.... 'E' = 14, 'F' = 15). You then multiply the current total by 16 and add
the value of this digit.

Of course, you'd need an awfully big data type to hold the total if you have
20 to 40 bytes. But you really haven't explained anything about how you
wanted to store the result.
 
A

AlexS

There is no intrinsic type capable to hold 40 bytes value.

You can use only byte arrays for this kind of data (or int, long etc.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top