ARC/PAK ------- ARC file header structure Byte number Value(s) Meaning -------------------------------------------------------------- 0 $1A Header Flag 1 0-9 Compression method 2-14 --- Filename. 15-18 --- Compressed file size. 19-20 bits Date format 15-9 Year 8-5 Month 4-0 Day 21-22 bits Time format 15-11 Hours (military) 10-5 Minutes 4-0 Seconds 23-24 --- CRC-16 25-28 --- Original file size Compression method ------------------ 1 unpacked (obsolete) 2 unpacked 3 packed 4 squeezed (after packing) 5 crunched (obsolete) 6 crunched (after packing) (obsolete) 7 crunched (after packing, using faster hash algorithm) 8 crunched (after packing, using dynamic LZW variations) 9 Squashed c/o Phil Katz (no packing) (var. on crunching) 10 crushed (PAK only) 11 distilled (PAK only) NOTE: LZW is Lempel-Ziv-Welch compression algorithm LZH --- LZH file header structure Byte number Value(s) Meaning -------------------------------------------------------------- 0 --- Header size 1 --- Cksum of remaining bytes 2-6 --- Method 7-10 --- Compressed size 11-14 --- Uncompressed size 15-16 --- Time format 17-18 --- Date format 19-20 --- File attribute 21-22 --- Filename/path length 23-XX --- Filename/path XX+1-XX+2 --- CRC-16 Compression method ------------------ -lh0- No compression used -lh1- LZW, 4K buffer, Huffman for upper 6 bits of pos -lz4- LZW, Arithmetic Encoding -lz5- LZW, Arithmetic Encoding ZIP --- ZIP file header structures Local File Header ----------------- Byte number Value(s) Meaning -------------------------------------------------------------- 0-3 $04034B50 Local File Header Signature 4-5 --- Version needed to extract 6-7 --- General purpose bit flag 8-9 0-6 Compression method 10-11 --- Time 12-13 --- Date 14-17 --- CRC-32 18-21 --- Compressed size 22-25 --- Uncompressed size 26-27 --- Filename length 28-29 --- Extra field length 30-XX --- path/filename XX+1-YY --- extra field Central Directory Structure --------------------------- Byte number Value(s) Meaning -------------------------------------------------------------- 0-3 $02014B50 Central file header signature 4 --- Version made by 5 --- Host operating system 6 --- Version needed to extract 7 --- O/S of version needed for extraction 8-9 --- General purpose bit flag 10-11 0-6 Compression method 12-13 --- Time 14-15 --- Date 16-19 --- CRC-32 20-23 --- Compressed size 24-27 --- Uncompressed size 28-29 --- Filename length 30-31 --- Extra field length 32-33 --- File comment length 34-35 --- Disk number start 36-37 bit Internal file attributes 0 if = 1, file is apparently an ASCII or text file 0 if = 0, file apparently contains binary data 1-7 unused in version 1.0. 38-41 --- External file attributes, host system dependent 42-45 --- Relative offset of local header from the start of the first disk on which this file appears 46-XX --- Filename or path - should not contain a drive or device letter, or a leading slash. All slashes should be forward slashes '/' XX+1-YY --- extra field YY+1-ZZ --- file comment End of Central Directory Structure ---------------------------------- Byte number Value(s) Meaning -------------------------------------------------------------- 0-3 $06064B50 End of central dir signature 4-5 --- Number of this disk 6-7 --- Number of disk with start central dir 8-9 --- Total number of entries in central dir on this disk 10-11 --- total number entries in central dir 12-15 --- Size of the central directory 16-19 --- Offset of start of central directory with respect to the starting disk number 20-21 --- zipfile comment length 22-XX --- zipfile comment ZIP Values ---------- Host O/S Value Description Value Description ----- -------------------------- ----- ------------------------ 0 MS-DOS and OS/2 (FAT) 5 Atari ST 1 Amiga 6 OS/2 1.2 extended file sys 2 VMS 7 Macintosh 3 *nix 8 thru 4 VM/CMS 255 unused General Purpose Bit Flag Bit Description --------- ----------------------------------------- 0 If set, file is encrypted 1 If file Imploded and this bit is set, 8K sliding dictionary was used. If clear, 4K sliding dictionary was used. 2 If file Imploded and this bit is set, 3 Shannon-Fano trees were used. If clear, 2 Shannon-Fano trees were used. 3-4 unused 5-7 used internally by ZIP Note: Bits 1 and 2 are undefined if the compression method is other than type 6 (Imploding). Compression Method Name Method Description ----------- ------ -------------------------------------------- Stored 0 No compression Shrunk 1 LZW, 8K buffer, 9-13 bits with partial clearing Reduced-1 2 Probalistic compression, lower 7 bits Reduced-2 3 Probalistic compression, lower 6 bits Reduced-3 4 Probalistic compression, lower 5 bits Reduced-4 5 Probalistic compression, lower 4 bits Imploded 6 2/3 Shanno-Fano trees, 4K/8K sliding dictionary ZOO --- ZOO file header sturtures Master Header ------------- Byte number Value(s) Meaning -------------------------------------------------------------- 0-19 --- Archive header text 20-23 $FDC4A7DC File signature 24-27 --- pointer to 1st header 28-31 --- pointer to 1st header - 1 32 --- version making archive 33 --- minimum version needed to extract File Header ----------- Byte number Value(s) Meaning -------------------------------------------------------------- 0-3 $FDC4A7DC signature 4 --- type of directory entry 5 0-1 Compression method 6-9 --- position of next dir entry 10-13 --- position of header 14-15 --- Date 16-17 --- Time 18-19 --- CRC-16 20-23 --- Uncompressed size 24-27 --- Compressed size 28 --- version that made this file 29 --- minimum version needed to extract 30 0-1 1 if file deleted from archive 31-34 --- pointer to comment, 0 if none 35-36 --- length of comment 37-XX --- path/filename Compression Method NAME DESCRIPTION ----------- -------------------------------------------- Stored No compression used Crunched Packing, LZW, 4K buffer, var len (9-13 bits) ARJ --- ARJ archives contains two types of header blocks: Archive main header - This is located at the head of the archive Local file header - This is located before each archived file Structure of archive block (low order byte first): Bytes Description ----- ------------------------------------------------------------------- 2 header id (main and local file) = 0xEA60 or 60000U 2 basic header size (from 'first_hdr_size' thru 'comment' below) = first_hdr_size + strlen(filename) + 1 + strlen(comment) + 1 = 0 if end of archive 1 first_hdr_size (size up to and including 'extra data') 1 archiver version number 1 minimum archiver version to extract 1 host OS (0 = MSDOS, 1 = PRIMOS, 2 = UNIX, 3 = AMIGA, 4 = MAC-OS) (5 = OS/2, 6 = APPLE GS, 7 = ATARI ST, 8 = NEXT) (9 = VAX VMS) 1 arj flags (0x01 = GARBLED_FLAG) indicates passworded file (0x02 = RESERVED) (0x04 = VOLUME_FLAG) indicates continued file to next volume (0x08 = EXTFILE_FLAG) indicates file starting position field (0x10 = PATHSYM_FLAG) indicates path translated ("\" changed to "/") 1 method (0 = stored, 1 = compressed most ... 4 compressed fastest) 1 file type (0 = binary, 1 = 7-bit text, 2 = comment header) (3 = directory, 4 = volume label) 1 reserved 4 date time modified 4 compressed size 4 original size (this will be different for text mode compression) 4 original file's CRC 2 filespec position in filename 2 file access mode 2 host data (currently not used) ? extra data 4 bytes for extended file starting position when used (this is present when EXTFILE_FLAG is set) ? filename (null-terminated string) ? comment (null-terminated string) 4 basic header CRC 2 1st extended header size (0 if none) ? 1st extended header (currently not used) 4 1st extended header's CRC (not present when 0 extended header size) ... ? compressed file Time stamp format: 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 |<---- year-1980 --->|<- month ->|<--- day ---->| 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 |<--- hour --->|<---- minute --->|<- second/2 ->| Compression methods: ARJ methods 1 to 3 use Lempel-Ziv 77 sliding window with static Huffman encoding. ARJ method 4 uses Lempel-Ziv 77 sliding window with pointer/length unary encoding. There is one decoder for methods 1 to 3 and one decoder for method 4. DWC --- Direcory-Eintrag: Byte Nr. Inhalt -------- ------------------------------------------------------- 0-12 Dateiname als ASCIZ-String 13-16 Original-Groesse 17-20 Datum/Uhrzeit 21-24 komprimierte Gr”áe 25-28 Startoffset im Archiv 29-31 ? 32 Methode (1=crunched, 2=stored) Trailer (Dateiende): Byte Nr. Inhalt ------- ------------------------------------------------------- 0-1 Gr”áe des Trailers (27) 2-3 Gr”áe der Directory-Eintr„ge (34) 4-19 ? 20-23 Anzahl Directory-Eintr„ge 24-26 "DWC" ($44 $57 $43) HYP --- Hyper file header structure Byte Nr. Inhalt -------- ------------------------------------------------------- 0 $1a 1-2 Methode ("HP" oder "ST") 3 Versionsnummer 4-7 komprimierte Gr”áe 8-11 Originalgr”áe 12-13 DOS-Uhrzeit 14-15 DOS-Datum 16-19 Checksumme 20 Attribut 21 L„nge des Dateinamens 22 Dateiname SQZ --- Archive Header: offset 0..4: Id: HLSQZ (072d 076d 083d 081d 090d) 5: Version: 1 (049d) 6: OS: 76543210 xxxxx000 0 PC-DOS xxxxx001 1 OS/2 xxxxx010 2 MVS xxxxx011 3 HPSF(OS/2) xxxxx100 4 Amiga xxxxx101 5 Macintosh xxxxx110 6 *nix xxxxx111 7 Future use XXXXXxxx Future use 7: Flag 76543210 xxxxxxx1 Big Endian xxxxxx1x DOS format for Date and Time in file: E8631E19. Decoded: 1992/08/30 12.31.32 MSB LSB 19 1E 63 E8 76543210765432107654321076543210 00011001000111100110001111101000 YYYYYYYMMMMDDDDDHHHHHMMMMMM22222 12 8 30 12 31 16 +=1980 *=2 1992 08 30 12 31 32 xxxxx1xx Security Envelope XXXXXxxx Future use File header: offset Size Comment ------------------------------------------------------------------ 0 1 Header size and type 0 -> End of archive 1 -> Comment 2 -> Password 3 -> Security envelope 4..18 -> future use 19.. -> normal file header if normal file Normal file: 1 1 Header algebraic sum & 0FFh 2 1:76543210 xxxxXXXX Method 0..4(15) xxx1xxxx Security envelope should follow XXXxxxxx Future use 3 4 Compressed size 7 4 Original size 11 4 Last DateTime 15 1 Attributes 16 4 CRC 20.. (size-18) filename, w/o \0. Comment: 1 2 Number of bytes in comment Uncompressed size = this field - 7 3 2 Number of bytes compressed 5 1:76543210 xxxxXXXX Method 0..4(15) xxx1xxxx Security envelope should follow XXXxxxxx Future use 6 4 CRC 8 size Comment Password: 1 2 4 3 4 CRC for password Otherwise: 1 2 n 3 n Data