Got a binary blob string like:
input = "AB02CF4AFF"
Every pair "AB", "02", "CF", "4A", "FF" constitute a byte. I'm doing this:
data = StringIO()
for j in range(0, len(input)/2):
bit = input[j*2:j*2+2]
data.write('%c' % int(bit,16))
data.seek(0)
Works ok, but with large binary blobs this becomes unacceptable slow and sometimes event throws a MemoryError.
struct.unpack comes to mind, but no luck thus far.
Any way to speed this up?