I have and Hex data in which there are three data present on which I can separate the information contain in the hex data:
- ID (2 bytes)
- length of the packet(2 bytes)
- information
from the length of the packet, we come to know how long is the data in this hex data for example hex data = 0001001447364B5F48312E305F56312E312E3165000300133836333932313033343330343337310004000838303634000200154D414A3258584D524A32444A363135303900050005010006000843415244000700094341524431000800050000090018383939313035323138303935393533303834300D000A000E706F7274616C6E6D6D73
if we manually separate this HEX data according to the above information then we get this data 0001001447364B5F48312E305F56312E312E3165
here
id=0001
packet lenght=0014=20
information = 47364B5F48312E305F56312E312E3165
i have tried to separate the information by my code but it only separates the first data I want to separate the whole hex data
this is my python code:
data="0001001447364B5F48312E305F56312E312E316500030013383633393231303334333034333731"
t=data[0:4]
l=data[4:8]
hex_to_decimal=int(l, 16)
data1=data[0:hex_to_decimal*2]
print(data1)
can anyone help me to figure it up