compress revision 186690
1251607Sdim
2251607Sdim#------------------------------------------------------------------------------
3251607Sdim# compress:  file(1) magic for pure-compression formats (no archives)
4251607Sdim#
5251607Sdim# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
6251607Sdim#
7251607Sdim# Formats for various forms of compressed data
8251607Sdim# Formats for "compress" proper have been moved into "compress.c",
9251607Sdim# because it tries to uncompress it to figure out what's inside.
10251607Sdim
11251607Sdim# standard unix compress
12251607Sdim0	string		\037\235	compress'd data
13251607Sdim!:mime	application/x-compress
14251607Sdim>2	byte&0x80	>0		block compressed
15251607Sdim>2	byte&0x1f	x		%d bits
16251607Sdim
17251607Sdim# gzip (GNU zip, not to be confused with Info-ZIP or PKWARE zip archiver)
18251607Sdim#   Edited by Chris Chittleborough <cchittleborough@yahoo.com.au>, March 2002
19251607Sdim#	* Original filename is only at offset 10 if "extra field" absent
20251607Sdim#	* Produce shorter output - notably, only report compression methods
21251607Sdim#	  other than 8 ("deflate", the only method defined in RFC 1952).
22251607Sdim0       string          \037\213        gzip compressed data
23251607Sdim!:mime	application/x-gzip
24263508Sdim>2	byte		<8		\b, reserved method
25263508Sdim>2	byte		>8		\b, unknown method
26263508Sdim>3	byte		&0x01		\b, ASCII
27263508Sdim>3	byte		&0x02		\b, has CRC
28263508Sdim>3	byte		&0x04		\b, extra field
29263508Sdim>3	byte&0xC	=0x08
30251607Sdim>>10	string		x		\b, was "%s"
31263508Sdim>3	byte		&0x10		\b, has comment
32263508Sdim>9	byte		=0x00		\b, from FAT filesystem (MS-DOS, OS/2, NT)
33263508Sdim>9	byte		=0x01		\b, from Amiga
34263508Sdim>9	byte		=0x02		\b, from VMS
35263508Sdim>9	byte		=0x03		\b, from Unix
36251607Sdim>9	byte		=0x04		\b, from VM/CMS
37263508Sdim>9	byte		=0x05		\b, from Atari
38263508Sdim>9	byte		=0x06		\b, from HPFS filesystem (OS/2, NT)
39263508Sdim>9	byte		=0x07		\b, from MacOS
40263508Sdim>9	byte		=0x08		\b, from Z-System
41263508Sdim>9	byte		=0x09		\b, from CP/M
42263508Sdim>9	byte		=0x0A		\b, from TOPS/20
43251607Sdim>9	byte		=0x0B		\b, from NTFS filesystem (NT)
44251607Sdim>9	byte		=0x0C		\b, from QDOS
45251607Sdim>9	byte		=0x0D		\b, from Acorn RISCOS
46251607Sdim>3	byte		&0x10		\b, comment
47251607Sdim>3	byte		&0x20		\b, encrypted
48251607Sdim>4	ledate		>0		\b, last modified: %s
49251607Sdim>8	byte		2		\b, max compression
50251607Sdim>8	byte		4		\b, max speed
51251607Sdim
52251607Sdim# packed data, Huffman (minimum redundancy) codes on a byte-by-byte basis
53251607Sdim0	string		\037\036	packed data
54251607Sdim!:mime	application/octet-stream
55251607Sdim>2	belong		>1		\b, %d characters originally
56251607Sdim>2	belong		=1		\b, %d character originally
57251607Sdim#
58251607Sdim# This magic number is byte-order-independent.
59251607Sdim0	short		0x1f1f		old packed data
60251607Sdim!:mime	application/octet-stream
61263508Sdim
62263508Sdim# XXX - why *two* entries for "compacted data", one of which is
63263508Sdim# byte-order independent, and one of which is byte-order dependent?
64263508Sdim#
65263508Sdim0	short		0x1fff		compacted data
66263508Sdim!:mime	application/octet-stream
67263508Sdim# This string is valid for SunOS (BE) and a matching "short" is listed
68263508Sdim# in the Ultrix (LE) magic file.
69263508Sdim0	string		\377\037	compacted data
70263508Sdim!:mime	application/octet-stream
71263508Sdim0	short		0145405		huf output
72263508Sdim!:mime	application/octet-stream
73263508Sdim
74263508Sdim# bzip2
75263508Sdim0	string		BZh		bzip2 compressed data
76263508Sdim!:mime	application/x-bzip2
77263508Sdim>3	byte		>47		\b, block size = %c00k
78263508Sdim
79263508Sdim# squeeze and crunch
80263508Sdim# Michael Haardt <michael@cantor.informatik.rwth-aachen.de>
81263508Sdim0	beshort		0x76FF		squeezed data,
82263508Sdim>4	string		x		original name %s
83263508Sdim0	beshort		0x76FE		crunched data,
84263508Sdim>2	string		x		original name %s
85263508Sdim0	beshort		0x76FD		LZH compressed data,
86263508Sdim>2	string		x		original name %s
87263508Sdim
88263508Sdim# Freeze
89263508Sdim0	string		\037\237	frozen file 2.1
90263508Sdim0	string		\037\236	frozen file 1.0 (or gzip 0.5)
91263508Sdim
92263508Sdim# SCO compress -H (LZH)
93263508Sdim0	string		\037\240	SCO compress -H (LZH) data
94263508Sdim
95251607Sdim# European GSM 06.10 is a provisional standard for full-rate speech
96251607Sdim# transcoding, prI-ETS 300 036, which uses RPE/LTP (residual pulse
97251607Sdim# excitation/long term prediction) coding at 13 kbit/s.
98251607Sdim#
99251607Sdim# There's only a magic nibble (4 bits); that nibble repeats every 33
100251607Sdim# bytes.  This isn't suited for use, but maybe we can use it someday.
101251607Sdim#
102251607Sdim# This will cause very short GSM files to be declared as data and
103251607Sdim# mismatches to be declared as data too!
104251607Sdim#0	byte&0xF0	0xd0		data
105263508Sdim#>33	byte&0xF0	0xd0
106263508Sdim#>66	byte&0xF0	0xd0
107251607Sdim#>99	byte&0xF0	0xd0
108251607Sdim#>132	byte&0xF0	0xd0		GSM 06.10 compressed audio
109251607Sdim
110251607Sdim# bzip	a block-sorting file compressor
111251607Sdim#	by Julian Seward <sewardj@cs.man.ac.uk> and others
112251607Sdim#
113251607Sdim#0	string		BZ		bzip compressed data
114263508Sdim#>2	byte		x		\b, version: %c
115263508Sdim#>3	string		=1		\b, compression block size 100k
116251607Sdim#>3	string		=2		\b, compression block size 200k
117251607Sdim#>3	string		=3		\b, compression block size 300k
118251607Sdim#>3	string		=4		\b, compression block size 400k
119251607Sdim#>3	string		=5		\b, compression block size 500k
120263508Sdim#>3	string		=6		\b, compression block size 600k
121263508Sdim#>3	string		=7		\b, compression block size 700k
122263508Sdim#>3	string		=8		\b, compression block size 800k
123263508Sdim#>3	string		=9		\b, compression block size 900k
124263508Sdim
125263508Sdim# lzop from <markus.oberhumer@jk.uni-linz.ac.at>
126263508Sdim0	string		\x89\x4c\x5a\x4f\x00\x0d\x0a\x1a\x0a	lzop compressed data
127263508Sdim>9	beshort		<0x0940
128263508Sdim>>9	byte&0xf0	=0x00		- version 0.
129263508Sdim>>9	beshort&0x0fff	x		\b%03x,
130263508Sdim>>13	byte		1		LZO1X-1,
131263508Sdim>>13	byte		2		LZO1X-1(15),
132263508Sdim>>13	byte		3		LZO1X-999,
133263508Sdim## >>22	bedate		>0		last modified: %s,
134263508Sdim>>14	byte		=0x00		os: MS-DOS
135263508Sdim>>14	byte		=0x01		os: Amiga
136263508Sdim>>14	byte		=0x02		os: VMS
137263508Sdim>>14	byte		=0x03		os: Unix
138251607Sdim>>14	byte		=0x05		os: Atari
139251607Sdim>>14	byte		=0x06		os: OS/2
140251607Sdim>>14	byte		=0x07		os: MacOS
141251607Sdim>>14	byte		=0x0A		os: Tops/20
142251607Sdim>>14	byte		=0x0B		os: WinNT
143251607Sdim>>14	byte		=0x0E		os: Win32
144263508Sdim>9	beshort		>0x0939
145263508Sdim>>9	byte&0xf0	=0x00		- version 0.
146263508Sdim>>9	byte&0xf0	=0x10		- version 1.
147263508Sdim>>9	byte&0xf0	=0x20		- version 2.
148263508Sdim>>9	beshort&0x0fff	x		\b%03x,
149263508Sdim>>15	byte		1		LZO1X-1,
150263508Sdim>>15	byte		2		LZO1X-1(15),
151251607Sdim>>15	byte		3		LZO1X-999,
152263508Sdim## >>25	bedate		>0		last modified: %s,
153263508Sdim>>17	byte		=0x00		os: MS-DOS
154263508Sdim>>17	byte		=0x01		os: Amiga
155251607Sdim>>17	byte		=0x02		os: VMS
156251607Sdim>>17	byte		=0x03		os: Unix
157251607Sdim>>17	byte		=0x05		os: Atari
158251607Sdim>>17	byte		=0x06		os: OS/2
159251607Sdim>>17	byte		=0x07		os: MacOS
160251607Sdim>>17	byte		=0x0A		os: Tops/20
161263508Sdim>>17	byte		=0x0B		os: WinNT
162251607Sdim>>17	byte		=0x0E		os: Win32
163251607Sdim
164251607Sdim# 4.3BSD-Quasijarus Strong Compression
165251607Sdim# http://minnie.tuhs.org/Quasijarus/compress.html
166251607Sdim0	string		\037\241	Quasijarus strong compressed data
167251607Sdim
168251607Sdim# From: Cory Dikkers <cdikkers@swbell.net>
169251607Sdim0	string		XPKF		Amiga xpkf.library compressed data
170251607Sdim0	string		PP11		Power Packer 1.1 compressed data
171251607Sdim0	string		PP20		Power Packer 2.0 compressed data,
172263508Sdim>4	belong		0x09090909	fast compression
173263508Sdim>4	belong		0x090A0A0A	mediocre compression
174263508Sdim>4	belong		0x090A0B0B	good compression
175263508Sdim>4	belong		0x090A0C0C	very good compression
176263508Sdim>4	belong		0x090A0C0D	best compression
177263508Sdim
178263508Sdim# 7-zip archiver, from Thomas Klausner (wiz@danbala.tuwien.ac.at)
179263508Sdim# http://www.7-zip.org or DOC/7zFormat.txt 
180263508Sdim#
181263508Sdim0	string		7z\274\257\047\034	7-zip archive data,
182263508Sdim>6	byte		x			version %d
183263508Sdim>7	byte		x			\b.%d
184263508Sdim
185263508Sdim# Type: LZMA
186263508Sdim# URL:  http://www.7-zip.org/sdk.html
187263508Sdim# From: Robert Millan <rmh@aybabtu.com> and Reuben Thomas <rrt@sc3d.org>
188263508Sdim# Commented out because apparently not reliable (according to Debian
189263508Sdim# bug #364260)
190263508Sdim#0	string		]\000\000\200\000	LZMA compressed data
191263508Sdim
192263508Sdim# AFX compressed files (Wolfram Kleff)
193263508Sdim2	string		-afx-		AFX compressed file data
194263508Sdim
195263508Sdim# Supplementary magic data for the file(1) command to support
196263508Sdim# rzip(1).  The format is described in magic(5).
197263508Sdim#
198263508Sdim# Copyright (C) 2003 by Andrew Tridgell.  You may do whatever you want with
199263508Sdim# this file.
200263508Sdim#
201263508Sdim0	string		RZIP		rzip compressed data
202263508Sdim>4	byte		x		- version %d
203263508Sdim>5	byte		x		\b.%d
204263508Sdim>6	belong		x		(%d bytes)
205263508Sdim