Winter 1998: Huffman Compression

In 1952 David Huffman invented data compression by discovering a method to assign the optimal unambiguous encoding to the symbols in a given message. This article explains how data compression works, and Huffman's method in detail, and also explains how the module is implemented. The module implements the Huffman data compression algorithm in Perl.


There's a bug somewhere that I never bothered to track down. In some files, the last few bytes are garbled either in the compression or the decompression phase. I'm not sure which and I haven't found a short test file that fails. If you do find a short test case that exercises the bug, or you find the bug, please let me know.

**Done!** 17 December 2001: Eric Prestemon has found the bug. The problem was that the output was emitted in 8-bit chunks, and if there were leftover bits at the end, they were never written to the output file. Thanks to Jerrad Pierce for supplying a patch.


Return to: Universe of Discourse main page | What's new page | Perl Paraphernalia


mjd-tpj-huffman@plover.com