Hachoir is a Python library used to represent a binary file as a tree of Python objects. Each object has a type, a value, an address, etc. The goal is to be able to know the meaning of each bit in a file. Hachoir is able to open invalid or truncated files. It only reads or computes data on demand to minimize load times. Many field types are predefined (integer, bit, string, etc.) and strings with a given character set (such as ISO-8859-1 or UTF-8) are supported. Addresses and sizes are stored in bits.