Muchin
Muchin

Reputation: 4997

Deflate Compression Algorithm Implemented in High Level Language?

There are lots of implementations of the Deflate decompression algorithm in different languages. The decompression algorithm itself is described in RFC1951. However, the compression algorithm seems more elusive and I've only ever seen it implemented in long C/C++ files.

I'd like to find an implementation of the compression algorithm in a higher level language, e.g. Python/Ruby/Lua/etc., for study purposes. Can someone point me to one?

Upvotes: 3

Views: 2500

Answers (1)

Null Set
Null Set

Reputation: 5414

Pyflate is a pure python implementation of gzip (which uses DEFLATE). http://www.paul.sladen.org/projects/pyflate/

Edit: Here is a python implementation of LZ77 compression, which is the first step in DEFLATE.

https://github.com/olle/lz77-kit/blob/master/src/main/python/lz77.py

The next step, Huffman encoding of the symbols, is a simple greedy algorithm which shouldn't be too hard to implement.

Upvotes: 1

Related Questions