>>> c = BitStruct('bs', Array(96, Bit('b')))
>>> c.parse('aa55aa55ffff0000aa55aa55'.decode('hex'))
Container({'b': [1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1]})
>>> d = Struct('s', EmbeddedBitStruct(BitStruct('bs', Array(96, Bit('b')))))
>>> d.parse('aa55aa55ffff0000aa55aa55'.decode('hex'))
---------------------------------------------------------------------------
SizeofError Traceback (most recent call last)
<ipython-input-69-c863f7ae7f02> in <module>()
----> 1 d.parse('aa55aa55ffff0000aa55aa55'.decode('hex'))
<pythonpath>/site-packages/construct/core.pyc in parse(self, data)
--> 188 return self.parse_stream(BytesIO(data))
<pythonpath>/site-packages/construct/core.pyc in parse_stream(self, stream)
--> 198 return self._parse(stream, Container())
<pythonpath>/site-packages/construct/core.pyc in _parse(self, stream, context)
--> 668 sc._parse(stream, context)
<pythonpath>/site-packages/construct/core.pyc in _parse(self, stream, context)
-> 1094 data = _read_stream(stream, self._sizeof(context))
<pythonpath>/site-packages/construct/core.pyc in _sizeof(self, context)
-> 1105 return self.resizer(self.subcon._sizeof(context))
<pythonpath>/site-packages/construct/macros.pyc in resizer(length)
--> 354 raise SizeofError("size must be a multiple of 8", length)
SizeofError: ('size must be a multiple of 8', 12)
'aa55aa55ffff0000aa55aa55'
) (https://docs.python.org/3.1/library/functions.html#bytearray). bytearrays are great for manipulating binary data in Python, if you are not aware of that....