Bit substring search

Kris Kennaway kris at
Tue Jun 24 15:51:53 CEST 2008

bearophileHUGS at wrote:
> Kris Kennaway:
>> I am trying to parse a bit-stream file format (bzip2) that does not have
>> byte-aligned record boundaries, so I need to do efficient matching of
>> bit substrings at arbitrary bit offsets.
>> Is there a package that can do this?
> You may take a look at Hachoir or some other modules:

Thanks.  hachoir also comes close, but it also doesnt seem to be able to 
match substrings at a bit level (e.g. the included bzip2 parser just 
reads the header and hands the entire file off to libbzip2 to extract 
data from).

construct exports a bit stream but it's again pure python and matching 
substrings will be slow.  It will need C support to do that efficiently.

> Etc. More:

Unfortunately I didnt find anything else useful here yet :(


More information about the Python-list mailing list