[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lzip-bug] Identifying lzip-compressed files
From: |
Antonio Diaz Diaz |
Subject: |
Re: [Lzip-bug] Identifying lzip-compressed files |
Date: |
Mon, 21 Mar 2011 18:07:50 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.11) Gecko/20050905 |
Hello Mark,
address@hidden wrote:
I want to identify, with as much certainty as possible, whether a file is
lzip-compressed.
[...]
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.
The maximum dictionary size LZMA can use is (4GiB -1), and the obvious
way to code it is using the values 30, 31 and 00 to represent 1Gib, 2Gib
and (4GiB -1) respectively in bits [4:0].
So a complete test, guaranteed to work for version 1 files produced by
any future version of lzip, would be like this:
( DS & 0x1F ) > 12 || ( DS & 0x1F ) == 0 || DS == 12
Best regards,
Antonio.