[Zlib-devel] Inflate detection of random data

Paul Marquess Paul.Marquess at btinternet.com
Thu Nov 28 03:25:01 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.

Tried the same with 1 million random strings. I assume that after the
attempted inflation, total_in tells you how far this got before.

total_in count
---------------
0       492
2       999023
3       114
4       23
5       32
6       32
7       147
8       39
9       19
10      22
11      26
12      8
13      2
14      1
15      4
16      2
17      4
19      2
22      2
27      2
28      1
37      1
40      1
44      1

Paul

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com




More information about the Zlib-devel mailing list