zlib/gzip解释器

4
问候您,我正在尝试分析zlib(gzip)算法的输出与输入之间的差异。确定诸如字典大小、子字符串运行长度对以及它们在原始明文中的位置等内容。我使用zlib来交换许多非常小的数据块(每个块小于1K),并希望确定从字典中产生的开销,结果中子字符串匹配与字典编码明文的百分比等内容。
在快速搜索未得到结果后,我在这里提问,避免在zlib源代码中插入调试消息以获得类似结果。
是否已经有现成的解决方案?

播种zlib听起来是个好主意。 - qdot
是的,对于一次性解决方案来说,它运行得相当不错。但如果要在公开场合展示修改后的代码,我会感到尴尬! - user17925
1个回答

4

请看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 :) - user257111

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接