2010-12-15 78 views
2

问候,我试图分析zlib(gzip)算法与输入相比较的输出。确定字典大小,子字符串游程长度对以及它们在原始明文中的对应位置等内容。我使用zlib来交换许多非常小的数据块(每个小于1K),并且想要确定字典中的开销,结果中子字符串匹配的百分比与字典编码的明文的比例,诸如此类。zlib/gzip解释器

在Google的快速搜索没有产生结果后,我在这里问了一下,在开始使用调试消息给zlib源代码播种以获得类似结果之前。

是否有现成的东西存在这样的东西?

+0

播种的zlib听起来是个好主意。 – qdot 2010-12-15 16:14:03

+0

是的,一次性解决方案效果相当不错。尽管在公共场合显示修改,我会感到尴尬! – user17925 2011-02-10 21:54:50

回答

3

看看http://zlib.net/infgen.c.gz

从代码中的注释:

* Read a zlib, gzip, or raw deflate stream from stdin and write a defgen 
* compatible stream representing that input to stdout (though any specific 
* zlib or gzip header information will be lost). This is based on the puff.c 
* code to decompress deflate streams. Note that neither the zlib nor the gzip 
* trailer is checked against the uncompressed data (in fact the uncompressed 
* data is never generated) -- all that is checked is that the trailer is 
* present. 
+2

嗨@Mark,欢迎来到SO - 只是一个说明,它有助于简要介绍您链接的内容,以便OP了解它是否解决了他们的问题,并打击了链接腐败。我已经提出了一些你的介绍性评论到这个答案,但随时编辑来改善,这听起来像这个链接将帮助OP非常:) – 2012-02-05 11:19:34