I reimplemented huff/cdic compression in Python, using a few tricks to speed it up. It runs about 25x faster than mobihuff.py on my machine.
While I was at it, I also:
* implemented support for uncompressed and Palmdoc-compressed .mobi files
* wrote a correct version of trailing data support
* avoided keeping the whole document in memory, massively reducing memory usage (~10MB vs ~183MB on my largest test file)
http://www.mit.edu/afs/user/m/y/mycroft/mobiunpack.py
PLEASE NOTE that this program is only for decompressing unencrypted Mobipocket files. It does not do anything with DRM.