Hex to Binary Conversion

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stephen

    #1

    Hex to Binary Conversion

    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.


  • AlexS

    #2
    Re: Hex to Binary Conversion

    Can you split them into shorter ones - byte by byte?

    "Stephen" <nospam@nospam. nowrote in message
    news:OjXZpdUyHH A.4300@TK2MSFTN GP04.phx.gbl...
    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.
    >
    >

    Comment

    • Stephen

      #3
      Re: Hex to Binary Conversion

      I could do that but for simplicity I was looking for a soultion to do the
      entire string at once.
      "AlexS" <salexru2000NO@ SPAMrogers.comP LEASEwrote in message
      news:uq3zajUyHH A.4260@TK2MSFTN GP06.phx.gbl...
      Can you split them into shorter ones - byte by byte?
      >
      "Stephen" <nospam@nospam. nowrote in message
      news:OjXZpdUyHH A.4300@TK2MSFTN GP04.phx.gbl...
      >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.
      >>
      >>
      >
      >

      Comment

      • Jonathan Wood

        #4
        Re: Hex to Binary Conversion

        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.

        --
        Jonathan Wood
        SoftCircuits Programming


        "Stephen" <nospam@nospam. nowrote in message
        news:%23bblXnUy HHA.1208@TK2MSF TNGP03.phx.gbl. ..
        >I could do that but for simplicity I was looking for a soultion to do the
        >entire string at once.
        "AlexS" <salexru2000NO@ SPAMrogers.comP LEASEwrote in message
        news:uq3zajUyHH A.4260@TK2MSFTN GP06.phx.gbl...
        >Can you split them into shorter ones - byte by byte?
        >>
        >"Stephen" <nospam@nospam. nowrote in message
        >news:OjXZpdUyH HA.4300@TK2MSFT NGP04.phx.gbl.. .
        >>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.
        >>>
        >>>
        >>
        >>
        >
        >

        Comment

        • AlexS

          #5
          Re: Hex to Binary Conversion

          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.)

          "Stephen" <nospam@nospam. nowrote in message
          news:%23bblXnUy HHA.1208@TK2MSF TNGP03.phx.gbl. ..
          >I could do that but for simplicity I was looking for a soultion to do the
          >entire string at once.
          "AlexS" <salexru2000NO@ SPAMrogers.comP LEASEwrote in message
          news:uq3zajUyHH A.4260@TK2MSFTN GP06.phx.gbl...
          >Can you split them into shorter ones - byte by byte?
          >>
          >"Stephen" <nospam@nospam. nowrote in message
          >news:OjXZpdUyH HA.4300@TK2MSFT NGP04.phx.gbl.. .
          >>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.
          >>>
          >>>
          >>
          >>
          >
          >

          Comment

          Working...