[Zlib-devel] Inflate detection of random data

Mark Adler madler at alumni.caltech.edu
Tue Nov 26 23:01:00 EST 2002


> On Tuesday, November 26, 2002, at 01:50  PM, Paul Marquess wrote:
>> By the way, apart from attempting to inflate it, is there any way to
>> determine if some content is raw deflate?
>
> Nope, that's the only way.  However you will find that if you feed
> random data to raw inflate, it will detect an error within the first
> hundred or so bytes almost every time.

Here is some actual data on that.  I fed random data to inflate 10,000 
times.  Below is a table of the ranges of the number of bytes required 
for inflate to discover an error, and the number of cases that fell in 
that range:

1:	2506
2-3:	688
4-7:	5070
8-15:	1500
16-31:	207
32-63:	27
64-127:	2

So in this example, it never took more that 127 bytes to find an error 
out of 10,000 cases.  A lot of the time, it would find an error in the 
first 15 bytes.

mark





More information about the Zlib-devel mailing list