Trying to match real gzip cases with RFC1951

  • Follow


I am trying to match real cases of compressed block with the document
of RFC 1951 - DEFLATE Compressed Data Format Specification version
1.3.htm

The examples are all four-byte files compressed with gzip. In each
example, all the 4 bytes are same data.

For example, file with content of 00 00 00 00 is compressed as:
0000000: 1f8b 0808 ece7 774a 0003 7261 775f 3033  ......wJ..raw_03
0000010: 0063 6060 6000 001c df44 2104 0000 00    .c```....D!....

I think the data "63 6060 6000 00" is the compressed block. All my
examples have same file size also after gzip. So I assume that the
compressed block of all these examples are at similar location of the
file, and give a table at the bottom. All these examples should have
only one compressed block in the file, so they are all final  blocks
in each file.

The spec mentioned:
Each block of compressed data begins with 3 header bits containing the
following data:
first bit       BFINAL
next 2 bits     BTYPE
Note that the header bits do not necessarily begin on a byte boundary,
since a block does not necessarily occupy an integral number of bytes.

I checked the table. But I cannot identify which bit is the BFINAL
bit, and which two bits are BTYPE bits. This prevents me from
analyzing the further part of the compressed block.

Would you please give idea? If your answer also includes the
identification of further parts, then it would be even better. Thanks.


original data    compression in file    compression in reverse

0000 0000    63 60 60 60 00 00    00 00 60 60 60 63
0101 0101    63 64 64 64 04 00    00 04 64 64 64 63
0202 0202    63 62 62 62 02 00    00 02 62 62 62 63
0808 0808    e3 e0 e0 e0 00 00    00 00 e0 e0 e0 e3
1010 1010    13 10 10 10 00 00    00 00 10 10 10 13
1111 1111    13 14 14 14 04 00    00 04 14 14 14 13
1212 1212    13 12 12 12 02 00    00 02 12 12 12 13
1818 1818    93 90 90 90 00 00    00 00 90 90 90 93
2020 2020    53 50 50 50 00 00    00 00 50 50 50 53
2121 2121    53 54 54 54 04 00    00 04 54 54 54 53
2222 2222    53 52 52 52 02 00    00 02 52 52 52 53
2828 2828    d3 d0 d0 d0 00 00    00 00 d0 d0 d0 d3
3030 3030    33 30 30 30 00 00    00 00 30 30 30 33
3131 3131    33 34 34 34 04 00    00 04 34 34 34 33
3232 3232    33 32 32 32 02 00    00 02 32 32 32 33
3333 3333    33 36 36 36 06 00    00 06 36 36 36 33
3434 3434    33 31 31 31 01 00    00 01 31 31 31 33
3535 3535    33 35 35 35 05 00    00 05 35 35 35 33
3636 3636    33 33 33 33 03 00    00 03 33 33 33 33
3737 3737    33 37 37 37 07 00    00 07 37 37 37 33
3838 3838    b3 b0 b0 b0 00 00    00 00 b0 b0 b0 b3
3939 3939    b3 b4 b4 b4 04 00    00 04 b4 b4 b4 b3
3a3a 3a3a    b3 b2 b2 b2 02 00    00 02 b2 b2 b2 b3
3b3b 3b3b    b3 b6 b6 b6 06 00    00 06 b6 b6 b6 b3
3c3c 3c3c    b3 b1 b1 b1 01 00    00 01 b1 b1 b1 b3
3d3d 3d3d    b3 b5 b5 b5 05 00    00 05 b5 b5 b5 b3
3e3e 3e3e    b3 b3 b3 b3 03 00    00 03 b3 b3 b3 b3
3f3f 3f3f    b3 b7 b7 b7 07 00    00 07 b7 b7 b7 b3
4040 4040    73 70 70 70 00 00    00 00 70 70 70 73
4141 4141    73 74 74 74 04 00    00 04 74 74 74 73
4242 4242    73 72 72 72 02 00    00 02 72 72 72 73
4848 4848    f3 f0 f0 f0 00 00    00 00 f0 f0 f0 f3
5050 5050    0b 08 08 08 00 00    00 00 08 08 08 0b
5151 5151    0b 0c 0c 0c 04 00    00 04 0c 0c 0c 0b
5252 5252    0b 0a 0a 0a 02 00    00 02 0a 0a 0a 0b
5858 5858    8b 88 88 88 00 00    00 00 88 88 88 8b
6060 6060    4b 48 48 48 00 00    00 00 48 48 48 4b
6161 6161    4b 4c 4c 4c 04 00    00 04 4c 4c 4c 4b
6262 6262    4b 4a 4a 4a 02 00    00 02 4a 4a 4a 4b
6868 6868    cb c8 c8 c8 00 00    00 00 c8 c8 c8 cb
7070 7070    2b 28 28 28 00 00    00 00 28 28 28 2b
7171 7171    2b 2c 2c 2c 04 00    00 04 2c 2c 2c 2b
8080 8080    6b 68 68 68 00 00    00 00 68 68 68 6b
8181 8181    6b 6c 6c 6c 04 00    00 04 6c 6c 6c 6b
9090 9090    9b 30 61 c2 04 00    00 04 c2 61 30 9b
9191 9191    9b 38 71 e2 44 00    00 44 e2 71 38 9b
9292 9292    9b 34 69 d2 24 00    00 24 d2 69 34 9b
9898 9898    9b 31 63 c6 0c 00    00 0c c6 63 31 9b
a0a0 a0a0    5b b0 60 c1 02 00    00 02 c1 60 b0 5b
b0b0 b0b0    db b0 61 c3 06 00    00 06 c3 61 b0 db
c0c0 c0c0    3b 70 e0 c0 01 00    00 01 c0 e0 70 3b
d0d0 d0d0    bb 70 e1 c2 05 00    00 05 c2 e1 70 bb
e0e0 e0e0    7b f0 e0 c1 03 00    00 03 c1 e0 f0 7b
f0f0 f0f0    fb f0 e1 c3 07 00    00 07 c3 e1 f0 fb
0
Reply chen_zhitao (70) 8/4/2009 11:54:59 AM

Oops, I should be able to identify it now, because it was already
answered in another post before. After thinking about the answer
clearly, I understand it now. So this question can be closed now.
Thanks.
0
Reply chen_zhitao (70) 8/5/2009 6:37:17 AM


1 Replies
68 Views

(page loaded in 0.056 seconds)

Similiar Articles:







7/22/2012 8:11:26 AM


Reply: