test[0x08:0x04]
is an empty string because the end index is smaller than the starting index.
For example, test[0x08:0x0A]
would give you two bytes as required by the h
code.
The syntax for string slicing is s[start:end]
or s[start:end:step]
. Link to docs