Hi,

I want to identify, with as much certainty as possible, whether a file is
lzip-compressed.

Bytes 0-3 must be 'LZIP' and byte 4 must be 0 or 1.

Byte 5 is the coded dictionary size. Since dictionary size is 4KB-512MB
bits [4:0] (when considered as a 5-bit number) must between 12 and 29. And
if bits [4:0] are 12 then bits [7:5] must be 0.

So I'd check whether something like this is true:
  (DS == 0x0C) || ( DS&0x1F > 12 && DS&0x1F < 30 )

However, should I relax or remove the dictionary size upper bound? A
future version of lzip might support larger dictionary sizes without any
other changes to the file format.


Mark



_______________________________________________
Lzip-bug mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lzip-bug

Reply via email to