Ok, so I am in a bit of a weird parsing scenario, but here it goes.
I have a script that reads in the bytes it needs to parse. I need to parse out those bytes and then return them.
Example
-------------------------------------------------------------------
Description: Log Parameters : Byte Offset: 0
-------------------------------------------------------------------
-------------------------------------------------------------------
Description: Offset : Byte Offset: 2-1
-------------------------------------------------------------------
-------------------------------------------------------------------
Description: Request Count : Byte Offset: 3
-------------------------------------------------------------------
-------------------------------------------------------------------
Description: Reserved : Byte Offset: 127-4
-------------------------------------------------------------------
So my script will eventually have the ability to output the hex associated with each line. For now, I need to say, ok, Byte offset is 0, go get the first byte and return it in hex. Ok, byte offset is 127-4, go get that, print the hex value right there on the screen.
The format is 127 bytes of hex stored in a string.
HEX String
100000000000000220000000000000003000000000000000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000
0000000000000000
The 0x prefix has been stripped and stored into a string.
There are a lot of zeroes in this example, but this is just a random case. The byte offsets can fluctuate, so I'm trying to figure out how to basically iterate through an array of byte offsets and parse them incrementally.
It's weird to me that if a description takes up so many bytes, bitwise operations become more difficult because I can't split these up into 32 or even 64 bit blocks.
What I Want
Currently I have an array of the byte offsets in the following form:
[0, 2-1, 3, 127-4]
I want to iterate through each of those byte offsets, parse them from long hex string and print them.
Question
How do I use the byte offsets from my array and parse them out of the hex string.