开发者

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 开发者_JAVA百科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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜