File: appnote.iz

package info (click to toggle)
libarchive-zip-perl 1.14-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 548 kB
  • ctags: 317
  • sloc: perl: 3,369; makefile: 45
file content (2470 lines) | stat: -rw-r--r-- 104,575 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
[Info-ZIP note, 20011203:  this file is based on PKWARE's appnote.txt of
 15 February 1996, taking into account PKWARE's revised appnote.txt
 version 4.5 of 01 November 2001.  It has been unofficially corrected
 and extended by Info-ZIP without explicit permission by PKWARE.
 Although Info-ZIP believes the information to be accurate and complete,
 it is provided under a disclaimer similar to the PKWARE disclaimer below,
 differing only in the substitution of "Info-ZIP" for "PKWARE".  In other
 words, use this information at your own risk, but we think it's correct.

 Specification info from PKWARE that was obviously wrong has been corrected
 silently (e.g. missing structure fields, wrong numbers).
 As of PKZIPW 2.50, two new incompatibilities have been introduced by PKWARE;
 they are noted below.  Note that the "NTFS tag" conflict is currently not
 real; PKZIPW 2.50 actually tags NTFS files as having come from a FAT
 file system, too.]


Disclaimer
----------

Although PKWARE will attempt to supply current and accurate
information relating to its file formats, algorithms, and the
subject programs, the possibility of error can not be eliminated.
PKWARE therefore expressly disclaims any warranty that the
information contained in the associated materials relating to the
subject programs and/or the format of the files created or
accessed by the subject programs and/or the algorithms used by
the subject programs, or any other matter, is current, correct or
accurate as delivered.  Any risk of damage due to any possible
inaccurate information is assumed by the user of the information.
Furthermore, the information relating to the subject programs
and/or the file formats created or accessed by the subject
programs and/or the algorithms used by the subject programs is
subject to change without notice.


General Format of a .ZIP file
-----------------------------

  Files stored in arbitrary order.  Large .ZIP files can span multiple
  diskette media or be split into user-defined segment sizes.  The
  minimum user-defined segment size for a split .ZIP file is 64K.

  Overall .ZIP file format:

    [local file header 1]
    [file data 1]
    [data descriptor 1]
    .
    .
    .
    [local file header n]
    [file data n]
    [data descriptor n]
    [central directory]
    [zip64 end of central directory record]
    [zip64 end of central directory locator]
    [end of central directory record]


  A.  Local file header:

        local file header signature     4 bytes  (0x04034b50)
        version needed to extract       2 bytes
        general purpose bit flag        2 bytes
        compression method              2 bytes
        last mod file time              2 bytes
        last mod file date              2 bytes
        crc-32                          4 bytes
        compressed size                 4 bytes
        uncompressed size               4 bytes
        file name length                2 bytes
        extra field length              2 bytes

        file name (variable size)
        extra field (variable size)


  B.  File data

      Immediately following the local header for a file
      is the compressed or stored data for the file.
      The series of [local file header][file data][data
      descriptor] repeats for each file in the .ZIP archive.

  C.  Data descriptor:

      [Info-ZIP discrepancy:
       The Info-ZIP zip program starts the data descriptor with a 4-byte
       PK-style signature.  Despite the specification, none of the PKWARE
       programs supports the data descriptor.  PKZIP 4.0 -fix function
       (and PKZIPFIX 2.04) ignores the data descriptor info even when bit 3
       of the general purpose bit flag is set.
        data descriptor signature       4 bytes  (0x08074b50)
      ]
        crc-32                          4 bytes
        compressed size                 4 bytes
        uncompressed size               4 bytes

      This descriptor exists only if bit 3 of the general
      purpose bit flag is set (see below).  It is byte aligned
      and immediately follows the last byte of compressed data.
      This descriptor is used only when it was not possible to
      seek in the output .ZIP file, e.g., when the output .ZIP file
      was standard output or a non seekable device.  For Zip64 format
      archives, the compressed and uncompressed sizes are 8 bytes each.

  D.  Central directory structure:

      [file header 1]
      .
      .
      .
      [file header n]
      [digital signature]

      File header:

        central file header signature   4 bytes  (0x02014b50)
        version made by                 2 bytes
        version needed to extract       2 bytes
        general purpose bit flag        2 bytes
        compression method              2 bytes
        last mod file time              2 bytes
        last mod file date              2 bytes
        crc-32                          4 bytes
        compressed size                 4 bytes
        uncompressed size               4 bytes
        file name length                2 bytes
        extra field length              2 bytes
        file comment length             2 bytes
        disk number start               2 bytes
        internal file attributes        2 bytes
        external file attributes        4 bytes
        relative offset of local header 4 bytes

        file name (variable size)
        extra field (variable size)
        file comment (variable size)

      Digital signature:

        header signature                4 bytes  (0x05054b50)
        size of data                    2 bytes
        signature data (variable size)


  E.  Zip64 end of central directory record

        zip64 end of central dir
        signature                       4 bytes  (0x06064b50)
        size of zip64 end of central
        directory record                8 bytes
        version made by                 2 bytes
        version needed to extract       2 bytes
        number of this disk             4 bytes
        number of the disk with the
        start of the central directory  4 bytes
        total number of entries in the
        central directory on this disk  8 bytes
        total number of entries in the
        central directory               8 bytes
        size of the central directory   8 bytes
        offset of start of central
        directory with respect to
        the starting disk number        8 bytes
        zip64 extensible data sector    (variable size)


  F.  Zip64 end of central directory locator

        zip64 end of central dir locator
        signature                       4 bytes  (0x07064b50)
        number of the disk with the
        start of the zip64 end of
        central directory               4 bytes
        relative offset of the zip64
        end of central directory record 8 bytes
        total number of disks           4 bytes


  G.  End of central directory record:

        end of central dir signature    4 bytes  (0x06054b50)
        number of this disk             2 bytes
        number of the disk with the
        start of the central directory  2 bytes
        total number of entries in the
        central directory on this disk  2 bytes
        total number of entries in
        the central directory           2 bytes
        size of the central directory   4 bytes
        offset of start of central
        directory with respect to
        the starting disk number        4 bytes
        .ZIP file comment length        2 bytes
        .ZIP file comment       (variable size)


  H.  Explanation of fields:

      version made by (2 bytes)

          [PKWARE describes "OS made by" now (since 1998) as follows:
          The upper byte indicates the compatibility of the file
          attribute information.  If the external file attributes
          are compatible with MS-DOS and can be read by PKZIP for
          DOS version 2.04g then this value will be zero.  If these
          attributes are not compatible, then this value will
          identify the host system on which the attributes are
          compatible.]
          The upper byte indicates the host system (OS) for the
          file.  Software can use this information to determine
          the line record format for text files etc.  The current
          mappings are:

          0 - FAT file system (DOS, OS/2, NT)      + PKWARE 2.50+ VFAT, NTFS
          1 - Amiga
          2 - OpenVMS
          3 - Unix
          4 - VM/CMS
          5 - Atari ST
          6 - HPFS file system (OS/2, NT 3.x)
          7 - Macintosh
          8 - Z-System
          9 - CP/M
          ---------------------------------------------------------------------
               PKWARE assignment             | Info-ZIP assignment
          -----------------------------------|---------------------------------
          10 - Windows NTFS                  | TOPS-20
               (since PKZIPW 2.50, but       | (assigned Oct-1992,
                not used by any PKWARE prog) |  no longer used)
          11 - MVS                           | NTFS file system (WinNT)
                                             | (actively used by Info-ZIP's
                                             |  Zip for NT since Sep-1993)
          12 - VSE                           | SMS/QDOS
          ---------------------------------------------------------------------
          13 - Acorn RISC OS
          14 - VFAT file system (Win95, NT)     [Info-ZIP reservation, unused]
          15 - MVS [PKWARE describes this assignment as "alternate MVS"]
          16 - BeOS (BeBox or PowerMac)
          17 - Tandem
          18 thru 255 - unused

          The lower byte indicates the version number of the
          software used to encode the file.  The value/10
          indicates the major version number, and the value
          mod 10 is the minor version number.

      version needed to extract (2 bytes)

          The minimum software version needed to extract the
          file, mapped as above.  For Zip64 format archives,
          this value should not be less than 45.

      general purpose bit flag: (2 bytes)

          Bit 0: If set, indicates that the file is encrypted.

          (For Method 6 - Imploding)
          Bit 1: If the compression method used was type 6,
                 Imploding, then this bit, if set, indicates
                 an 8K sliding dictionary was used.  If clear,
                 then a 4K sliding dictionary was used.
          Bit 2: If the compression method used was type 6,
                 Imploding, then this bit, if set, indicates
                 3 Shannon-Fano trees were used to encode the
                 sliding dictionary output.  If clear, then 2
                 Shannon-Fano trees were used.

          (For Methods 8 and 9 - Deflating)
          Bit 2  Bit 1
            0      0    Normal (-en) compression option was used.
            0      1    Maximum (-exx/-ex) compression option was used.
            1      0    Fast (-ef) compression option was used.
            1      1    Super Fast (-es) compression option was used.

          Note:  Bits 1 and 2 are undefined if the compression
                 method is any other.

          Bit 3: If this bit is set, the fields crc-32, compressed
                 size and uncompressed size are set to zero in the
                 local header.  The correct values are put in the
                 data descriptor immediately following the compressed
                 data.  (Note: PKZIP version 2.04g for DOS only
                 recognizes this bit for method 8 compression, newer
                 versions of PKZIP recognize this bit for any
                 compression method.)
                [Info-ZIP note: This bit was introduced by PKZIP 2.04 for
                 DOS. In general, this feature can only be reliably used
                 together with compression methods that allow intrinsic
                 detection of the "end-of-compressed-data" condition. From
                 the set of compression methods described in this Zip archive
                 specification, only "deflate" meets this requirement.
                 Especially, the method STORED does not work!
                 The Info-ZIP tools recognize this bit regardless of the
                 compression method; but, they rely on correctly set
                 "compressed size" information in the central directory entry.]

          Bit 4: Reserved for use with method 8, for enhanced
                 deflating.

          Bit 5: If this bit is set, this indicates that the file is
                 compressed patched data.  (Note: Requires PKZIP
                 version 2.70 or greater)

          Bit 6: Currently unused.

          Bit 7: Currently unused.

          Bit 8: Currently unused.

          Bit 9: Currently unused.

          Bit 10: Currently unused.

          Bit 11: Currently unused.

          Bit 12: Reserved by PKWARE for enhanced compression.

          Bit 13: Reserved by PKWARE.

          Bit 14: Reserved by PKWARE.

          Bit 15: Reserved by PKWARE.

      compression method: (2 bytes)

          (see accompanying documentation for algorithm
          descriptions)

          0 - The file is stored (no compression)
          1 - The file is Shrunk
          2 - The file is Reduced with compression factor 1
          3 - The file is Reduced with compression factor 2
          4 - The file is Reduced with compression factor 3
          5 - The file is Reduced with compression factor 4
          6 - The file is Imploded
          7 - Reserved for Tokenizing compression algorithm
          8 - The file is Deflated
          9 - Enhanced Deflating using Deflate64(tm)
         10 - PKWARE Data Compression Library Imploding

      date and time fields: (2 bytes each)

          The date and time are encoded in standard MS-DOS format.
          If input came from standard input, the date and time are
          those at which compression was started for this data.

      CRC-32: (4 bytes)

          The CRC-32 algorithm was generously contributed by
          David Schwaderer and can be found in his excellent
          book "C Programmers Guide to NetBIOS" published by
          Howard W. Sams & Co. Inc.  The 'magic number' for
          the CRC is 0xdebb20e3.  The proper CRC pre and post
          conditioning is used, meaning that the CRC register
          is pre-conditioned with all ones (a starting value
          of 0xffffffff) and the value is post-conditioned by
          taking the one's complement of the CRC residual.
          If bit 3 of the general purpose flag is set, this
          field is set to zero in the local header and the correct
          value is put in the data descriptor and in the central
          directory.

      compressed size: (4 bytes)
      uncompressed size: (4 bytes)

          The size of the file compressed and uncompressed,
          respectively.  If bit 3 of the general purpose bit flag
          is set, these fields are set to zero in the local header
          and the correct values are put in the data descriptor and
          in the central directory.  If an archive is in zip64 format
          and the value in this field is 0xFFFFFFFF, the size will be
          in the corresponding 8 byte zip64 extended information
          extra field.

      file name length: (2 bytes)
      extra field length: (2 bytes)
      file comment length: (2 bytes)

          The length of the file name, extra field, and comment
          fields respectively.  The combined length of any
          directory record and these three fields should not
          generally exceed 65,535 bytes.  If input came from standard
          input, the file name length is set to zero.

         [Info-ZIP note:
          This feature is not yet supported by any PKWARE version of ZIP
          (at least not in PKZIP for DOS and PKZIP for Windows/WinNT).
          The Info-ZIP programs handle standard input differently:
          If input came from standard input, the filename is set to "-"
          (length one).]


      disk number start: (2 bytes)

          The number of the disk on which this file begins.  If an
          archive is in zip64 format and the value in this field is
          0xFFFF, the size will be in the corresponding 4 byte zip64
          extended information extra field.

      internal file attributes: (2 bytes)

          The lowest bit of this field indicates, if set, that
          the file is apparently an ASCII or text file.  If not
          set, that the file apparently contains binary data.
          The remaining bits are unused in version 1.0.

          Bits 1 and 2 are reserved for use by PKWARE.

      external file attributes: (4 bytes)

          The mapping of the external attributes is
          host-system dependent (see 'version made by').  For
          MS-DOS, the low order byte is the MS-DOS directory
          attribute byte.  If input came from standard input, this
          field is set to zero.

      relative offset of local header: (4 bytes)

          This is the offset from the start of the first disk on
          which this file appears, to where the local header should
          be found.  If an archive is in zip64 format and the value
          in this field is 0xFFFFFFFF, the size will be in the
          corresponding 8 byte zip64 extended information extra field.

      file name: (Variable)

          The name of the file, with optional relative path.
          The path stored should not contain a drive or
          device letter, or a leading slash.  All slashes
          should be forward slashes '/' as opposed to
          backwards slashes '\' for compatibility with Amiga
          and Unix file systems etc.  If input came from standard
          input, there is no file name field.
         [Info-ZIP discrepancy:
          If input came from standard input, the file name is set
          to "-" (without the quotes).
          As far as we know, the PKWARE specification for "input from
          stdin" is not supported by PKZIP/PKUNZIP for DOS, OS/2, Windows
          Windows NT.]

      extra field: (Variable)

          This is for expansion.  If additional information
          needs to be stored for special needs or for specific
          platforms, it should be stored here.  Earlier versions
          of the software can then safely skip this file, and
          find the next file or header.  This field will be 0
          length in version 1.0.

          In order to allow different programs and different types
          of information to be stored in the 'extra' field in .ZIP
          files, the following structure should be used for all
          programs storing data in this field:

          header1+data1 + header2+data2 . . .

          Each header should consist of:

            Header ID - 2 bytes
            Data Size - 2 bytes

          Note: all fields stored in Intel low-byte/high-byte order.

          The Header ID field indicates the type of data that is in
          the following data block.

          Header ID's of 0 thru 31 are reserved for use by PKWARE.
          The remaining ID's can be used by third party vendors for
          proprietary usage.

          The current Header ID mappings defined by PKWARE are:

          0x0001        ZIP64 extended information extra field
          0x0007        AV Info
          0x0009        OS/2 extended attributes      (also Info-ZIP)
          0x000a        NTFS (Win9x/WinNT FileTimes)
          0x000c        OpenVMS                       (also Info-ZIP)
          0x000d        Unix
          0x000f        Patch Descriptor
          0x0014        PKCS#7 Store for X.509 Certificates
          0x0015        X.509 Certificate ID and Signature for
                        individual file
          0x0016        X.509 Certificate ID for Central Directory

          The Header ID mappings defined by Info-ZIP and third parties are:

          0x0065        IBM S/390 attributes - uncompressed
          0x0066        IBM S/390 attributes - compressed
          0x07c8        Info-ZIP Macintosh (old, J. Lee)
          0x2605        ZipIt Macintosh (first version)
          0x2705        ZipIt Macintosh v 1.3.5 and newer (w/o full filename)
          0x334d        Info-ZIP Macintosh (new, D. Haase's 'Mac3' field )
          0x4154        Tandem NSK
          0x4341        Acorn/SparkFS (David Pilling)
          0x4453        Windows NT security descriptor (binary ACL)
          0x4704        VM/CMS
          0x470f        MVS
          0x4854        Theos, old inofficial port
          0x4b46        FWKCS MD5 (see below)
          0x4c41        OS/2 access control list (text ACL)
          0x4d49        Info-ZIP OpenVMS (obsolete)
          0x4d63        Macintosh SmartZIP, by Macro Bambini
          0x4f4c        Xceed original location extra field
          0x5356        AOS/VS (binary ACL)
          0x5455        extended timestamp
          0x5855        Info-ZIP Unix (original; also OS/2, NT, etc.)
          0x554e        Xceed unicode extra field
          0x6542        BeOS (BeBox, PowerMac, etc.)
          0x6854        Theos
          0x756e        ASi Unix
          0x7855        Info-ZIP Unix (new)
          0xfb4a        SMS/QDOS

          The Data Size field indicates the size of the following
          data block. Programs can use this value to skip to the
          next header block, passing over any data blocks that are
          not of interest.

          Note: As stated above, the size of the entire .ZIP file
                header, including the file name, comment, and extra
                field should not exceed 64K in size.

          In case two different programs should appropriate the same
          Header ID value, it is strongly recommended that each
          program place a unique signature of at least two bytes in
          size (and preferably 4 bytes or bigger) at the start of
          each data area.  Every program should verify that its
          unique signature is present, in addition to the Header ID
          value being correct, before assuming that it is a block of
          known type.

          In the following descriptions, note that "Short" means two bytes,
          "Long" means four bytes, and "Long-Long" means eight bytes,
          regardless of their native sizes.  Unless specifically noted, all
          integer fields should be interpreted as unsigned (non-negative)
          numbers.


         -OS/2 Extended Attributes Extra Field:
          ====================================

          The following is the layout of the OS/2 extended attributes "extra"
          block.  (Last Revision 19960922)

          Note: all fields stored in Intel low-byte/high-byte order.

          Local-header version:

          Value         Size        Description
          -----         ----        -----------
  (OS/2)  0x0009        Short       tag for this extra block type
          TSize         Short       total data size for this block
          BSize         Long        uncompressed EA data size
          CType         Short       compression type
          EACRC         Long        CRC value for uncompressed EA data
          (var.)        variable    compressed EA data

          Central-header version:

          Value         Size        Description
          -----         ----        -----------
  (OS/2)  0x0009        Short       tag for this extra block type
          TSize         Short       total data size for this block (4)
          BSize         Long        size of uncompressed local EA data

          The value of CType is interpreted according to the "compression
          method" section above; i.e., 0 for stored, 8 for deflated, etc.

          The OS/2 extended attribute structure (FEA2LIST) is compressed and
          then stored in its entirety within this structure.  There will only
          ever be one block of data in the variable-length field.


         -OS/2 Access Control List Extra Field:
          ====================================

          The following is the layout of the OS/2 ACL extra block.
          (Last Revision 19960922)

          Local-header version:

          Value         Size        Description
          -----         ----        -----------
  (ACL)   0x4c41        Short       tag for this extra block type ("AL")
          TSize         Short       total data size for this block
          BSize         Long        uncompressed ACL data size
          CType         Short       compression type
          EACRC         Long        CRC value for uncompressed ACL data
          (var.)        variable    compressed ACL data

          Central-header version:

          Value         Size        Description
          -----         ----        -----------
  (ACL)   0x4c41        Short       tag for this extra block type ("AL")
          TSize         Short       total data size for this block (4)
          BSize         Long        size of uncompressed local ACL data

          The value of CType is interpreted according to the "compression
          method" section above; i.e., 0 for stored, 8 for deflated, etc.

          The uncompressed ACL data consist of a text header of the form
          "ACL1:%hX,%hd\n", where the first field is the OS/2 ACCINFO acc_attr
          member and the second is acc_count, followed by acc_count strings
          of the form "%s,%hx\n", where the first field is acl_ugname (user
          group name) and the second acl_access.  This block type will be
          extended for other operating systems as needed.


         -Windows NT Security Descriptor Extra Field:
          ==========================================

          The following is the layout of the NT Security Descriptor (another
          type of ACL) extra block.  (Last Revision 19960922)

          Local-header version:

          Value         Size        Description
          -----         ----        -----------
  (SD)    0x4453        Short       tag for this extra block type ("SD")
          TSize         Short       total data size for this block
          BSize         Long        uncompressed SD data size
          Version       Byte        version of uncompressed SD data format
          CType         Short       compression type
          EACRC         Long        CRC value for uncompressed SD data
          (var.)        variable    compressed SD data

          Central-header version:

          Value         Size        Description
          -----         ----        -----------
  (SD)    0x4453        Short       tag for this extra block type ("SD")
          TSize         Short       total data size for this block (4)
          BSize         Long        size of uncompressed local SD data

          The value of CType is interpreted according to the "compression
          method" section above; i.e., 0 for stored, 8 for deflated, etc.
          Version specifies how the compressed data are to be interpreted
          and allows for future expansion of this extra field type.  Currently
          only version 0 is defined.

          For version 0, the compressed data are to be interpreted as a single
          valid Windows NT SECURITY_DESCRIPTOR data structure, in self-relative
          format.


         -PKWARE Win95/WinNT Extra Field:
          ==============================

          The following description covers PKWARE's "NTFS" attributes
          "extra" block, introduced with the release of PKZIP 2.50 for
          Windows. (Last Revision 20001118)

          (Note: At this time the Mtime, Atime and Ctime values may
          be used on any WIN32 system.)
         [Info-ZIP note: In the current implementations, this field has
          a fixed total data size of 32 bytes and is only stored as local
          extra field.]

          Value         Size        Description
          -----         ----        -----------
  (NTFS)  0x000a        Short       Tag for this "extra" block type
          TSize         Short       Total Data Size for this block
          Reserved      Long        for future use
          Tag1          Short       NTFS attribute tag value #1
          Size1         Short       Size of attribute #1, in bytes
          (var.)        SubSize1    Attribute #1 data
          .
          .
          .
          TagN          Short       NTFS attribute tag value #N
          SizeN         Short       Size of attribute #N, in bytes
          (var.)        SubSize1    Attribute #N data

          For NTFS, values for Tag1 through TagN are as follows:
          (currently only one set of attributes is defined for NTFS)

          Tag        Size       Description
          -----      ----       -----------
          0x0001     2 bytes    Tag for attribute #1
          Size1      2 bytes    Size of attribute #1, in bytes (24)
          Mtime      8 bytes    64-bit NTFS file last modification time
          Atime      8 bytes    64-bit NTFS file last access time
          Ctime      8 bytes    64-bit NTFS file creation time

          The total length for this block is 28 bytes, resulting in a
          fixed size value of 32 for the TSize field of the NTFS block.

          The NTFS filetimes are 64-bit unsigned integers, stored in Intel
          (least significant byte first) byte order. They determine the
          number of 1.0E-07 seconds (1/10th microseconds!) past WinNT "epoch",
          which is "01-Jan-1601 00:00:00 UTC".


         -PKWARE OpenVMS Extra Field:
          ==========================

          The following is the layout of PKWARE's OpenVMS attributes "extra"
          block.  (Last Revision 12/17/91)

          Note: all fields stored in Intel low-byte/high-byte order.

          Value         Size        Description
          -----         ----        -----------
  (VMS)   0x000c        Short       Tag for this "extra" block type
          TSize         Short       Total Data Size for this block
          CRC           Long        32-bit CRC for remainder of the block
          Tag1          Short       OpenVMS attribute tag value #1
          Size1         Short       Size of attribute #1, in bytes
          (var.)        Size1       Attribute #1 data
          .
          .
          .
          TagN          Short       OpenVMS attribute tage value #N
          SizeN         Short       Size of attribute #N, in bytes
          (var.)        SizeN       Attribute #N data

          Rules:

          1. There will be one or more of attributes present, which
             will each be preceded by the above TagX & SizeX values.
             These values are identical to the ATR$C_XXXX and
             ATR$S_XXXX constants which are defined in ATR.H under
             OpenVMS C.  Neither of these values will ever be zero.

          2. No word alignment or padding is performed.

          3. A well-behaved PKZIP/OpenVMS program should never produce
             more than one sub-block with the same TagX value.  Also,
             there will never be more than one "extra" block of type
             0x000c in a particular directory record.


         -Info-ZIP VMS Extra Field:
          ========================

          The following is the layout of Info-ZIP's VMS attributes extra
          block for VAX or Alpha AXP.  The local-header and central-header
          versions are identical.  (Last Revision 19960922)

          Value         Size        Description
          -----         ----        -----------
  (VMS2)  0x4d49        Short       tag for this extra block type ("JM")
          TSize         Short       total data size for this block
          ID            Long        block ID
          Flags         Short       info bytes
          BSize         Short       uncompressed block size
          Reserved      Long        (reserved)
          (var.)        variable    compressed VMS file-attributes block

          The block ID is one of the following unterminated strings:

                "VFAB"          struct FAB
                "VALL"          struct XABALL
                "VFHC"          struct XABFHC
                "VDAT"          struct XABDAT
                "VRDT"          struct XABRDT
                "VPRO"          struct XABPRO
                "VKEY"          struct XABKEY
                "VMSV"          version (e.g., "V6.1"; truncated at hyphen)
                "VNAM"          reserved

          The lower three bits of Flags indicate the compression method.  The
          currently defined methods are:

                0       stored (not compressed)
                1       simple "RLE"
                2       deflated

          The "RLE" method simply replaces zero-valued bytes with zero-valued
          bits and non-zero-valued bytes with a "1" bit followed by the byte
          value.

          The variable-length compressed data contains only the data corre-
          sponding to the indicated structure or string.  Typically multiple
          VMS2 extra fields are present (each with a unique block type).


         -Info-ZIP Macintosh Extra Field:
          ==============================

          The following is the layout of the (old) Info-ZIP resource-fork extra
          block for Macintosh.  The local-header and central-header versions
          are identical.  (Last Revision 19960922)

          Value         Size        Description
          -----         ----        -----------
  (Mac)   0x07c8        Short       tag for this extra block type
          TSize         Short       total data size for this block
          "JLEE"        beLong      extra-field signature
          FInfo         16 bytes    Macintosh FInfo structure
          CrDat         beLong      HParamBlockRec fileParam.ioFlCrDat
          MdDat         beLong      HParamBlockRec fileParam.ioFlMdDat
          Flags         beLong      info bits
          DirID         beLong      HParamBlockRec fileParam.ioDirID
          VolName       28 bytes    volume name (optional)

          All fields but the first two are in native Macintosh format
          (big-endian Motorola order, not little-endian Intel).  The least
          significant bit of Flags is 1 if the file is a data fork, 0 other-
          wise.  In addition, if this extra field is present, the filename
          has an extra 'd' or 'r' appended to indicate data fork or resource
          fork.  The 28-byte VolName field may be omitted.


         -ZipIt Macintosh Extra Field (long):
          ==================================

          The following is the layout of the ZipIt extra block for Macintosh.
          The local-header and central-header versions are identical.
          (Last Revision 19970130)

          Value         Size        Description
          -----         ----        -----------
  (Mac2)  0x2605        Short       tag for this extra block type
          TSize         Short       total data size for this block
          "ZPIT"        beLong      extra-field signature
          FnLen         Byte        length of FileName
          FileName      variable    full Macintosh filename
          FileType      Byte[4]     four-byte Mac file type string
          Creator       Byte[4]     four-byte Mac creator string


         -ZipIt Macintosh Extra Field (short):
          ===================================

          The following is the layout of a shortened variant of the
          ZipIt extra block for Macintosh (without "full name" entry).
          This variant is used by ZipIt 1.3.5 and newer for entries that
          do not need a "full Mac filename" record.
          The local-header and central-header versions are identical.
          (Last Revision 19980903)

          Value         Size        Description
          -----         ----        -----------
  (Mac2b) 0x2705        Short       tag for this extra block type
          TSize         Short       total data size for this block (12)
          "ZPIT"        beLong      extra-field signature
          FileType      Byte[4]     four-byte Mac file type string
          Creator       Byte[4]     four-byte Mac creator string


         -Info-ZIP Macintosh Extra Field (new):
          ====================================

          The following is the layout of the (new) Info-ZIP extra
          block for Macintosh, designed by Dirk Haase.
          All values are in little-endian.
          (Last Revision 19981005)

          Local-header version:

          Value         Size        Description
          -----         ----        -----------
  (Mac3)  0x334d        Short       tag for this extra block type ("M3")
          TSize         Short       total data size for this block
          BSize         Long        uncompressed finder attribute data size
          Flags         Short       info bits
          fdType        Byte[4]     Type of the File (4-byte string)
          fdCreator     Byte[4]     Creator of the File (4-byte string)
          (CType)       Short       compression type
          (CRC)         Long        CRC value for uncompressed MacOS data
          Attribs       variable    finder attribute data (see below)


          Central-header version:

          Value         Size        Description
          -----         ----        -----------
  (Mac3)  0x334d        Short       tag for this extra block type ("M3")
          TSize         Short       total data size for this block
          BSize         Long        uncompressed finder attribute data size
          Flags         Short       info bits
          fdType        Byte[4]     Type of the File (4-byte string)
          fdCreator     Byte[4]     Creator of the File (4-byte string)

          The third bit of Flags in both headers indicates whether
          the LOCAL extra field is uncompressed (and therefore whether CType
          and CRC are omitted):

          Bits of the Flags:
              bit 0           if set, file is a data fork; otherwise unset
              bit 1           if set, filename will be not changed
              bit 2           if set, Attribs is uncompressed (no CType, CRC)
              bit 3           if set, date and times are in 64 bit
                              if zero date and times are in 32 bit.
              bit 4           if set, timezone offsets fields for the native
                              Mac times are omitted (UTC support deactivated)
              bits 5-15       reserved;


          Attributes:

          Attribs is a Mac-specific block of data in little-endian format with
          the following structure (if compressed, uncompress it first):

          Value         Size        Description
          -----         ----        -----------
          fdFlags       Short       Finder Flags
          fdLocation.v  Short       Finder Icon Location
          fdLocation.h  Short       Finder Icon Location
          fdFldr        Short       Folder containing file

          FXInfo        16 bytes    Macintosh FXInfo structure
            FXInfo-Structure:
                fdIconID        Short
                fdUnused[3]     Short       unused but reserved 6 bytes
                fdScript        Byte        Script flag and number
                fdXFlags        Byte        More flag bits
                fdComment       Short       Comment ID
                fdPutAway       Long        Home Dir ID

          FVersNum      Byte        file version number
                                    may be not used by MacOS
          ACUser        Byte        directory access rights

          FlCrDat       ULong       date and time of creation
          FlMdDat       ULong       date and time of last modification
          FlBkDat       ULong       date and time of last backup
            These time numbers are original Mac FileTime values (local time!).
            Currently, date-time width is 32-bit, but future version may
            support be 64-bit times (see flags)

          CrGMTOffs     Long(signed!)   difference "local Creat. time - UTC"
          MdGMTOffs     Long(signed!)   difference "local Modif. time - UTC"
          BkGMTOffs     Long(signed!)   difference "local Backup time - UTC"
            These "local time - UTC" differences (stored in seconds) may be
            used to support timestamp adjustment after inter-timezone transfer.
            These fields are optional; bit 4 of the flags word controls their
            presence.

          Charset       Short       TextEncodingBase (Charset)
                                    valid for the following two fields

          FullPath      variable    Path of the current file.
                                    Zero terminated string (C-String)
                                    Currently coded in the native Charset.

          Comment       variable    Finder Comment of the current file.
                                    Zero terminated string (C-String)
                                    Currently coded in the native Charset.


         -SmartZIP Macintosh Extra Field:
          ====================================

          The following is the layout of the SmartZIP extra
          block for Macintosh, designed by Marco Bambini.

          Local-header version:

          Value         Size        Description
          -----         ----        -----------
          0x4d63        Short       tag for this extra block type ("cM")
          TSize         Short       total data size for this block (64)
          "dZip"        beLong      extra-field signature
          fdType        Byte[4]     Type of the File (4-byte string)
          fdCreator     Byte[4]     Creator of the File (4-byte string)
          fdFlags       beShort     Finder Flags
          fdLocation.v  beShort     Finder Icon Location
          fdLocation.h  beShort     Finder Icon Location
          fdFldr        beShort     Folder containing file
          CrDat         beLong      HParamBlockRec fileParam.ioFlCrDat
          MdDat         beLong      HParamBlockRec fileParam.ioFlMdDat
          frScroll.v    Byte        vertical pos. of folder's scroll bar
          fdScript      Byte        Script flag and number
          frScroll.h    Byte        horizontal pos. of folder's scroll bar
          fdXFlags      Byte        More flag bits
          FileName      Byte[32]    full Macintosh filename (pascal string)

          All fields but the first two are in native Macintosh format
          (big-endian Motorola order, not little-endian Intel).
          The extra field size is fixed to 64 bytes.
          The local-header and central-header versions are identical.


         -Acorn SparkFS Extra Field:
          =========================

          The following is the layout of David Pilling's SparkFS extra block
          for Acorn RISC OS.  The local-header and central-header versions are
          identical.  (Last Revision 19960922)

          Value         Size        Description
          -----         ----        -----------
  (Acorn) 0x4341        Short       tag for this extra block type ("AC")
          TSize         Short       total data size for this block (20)
          "ARC0"        Long        extra-field signature
          LoadAddr      Long        load address or file type
          ExecAddr      Long        exec address
          Attr          Long        file permissions
          Zero          Long        reserved; always zero

          The following bits of Attr are associated with the given file
          permissions:

                bit 0           user-writable ('W')
                bit 1           user-readable ('R')
                bit 2           reserved
                bit 3           locked ('L')
                bit 4           publicly writable ('w')
                bit 5           publicly readable ('r')
                bit 6           reserved
                bit 7           reserved


         -VM/CMS Extra Field:
          ==================

          The following is the layout of the file-attributes extra block for
          VM/CMS.  The local-header and central-header versions are
          identical.  (Last Revision 19960922)

          Value         Size        Description
          -----         ----        -----------
 (VM/CMS) 0x4704        Short       tag for this extra block type
          TSize         Short       total data size for this block
          flData        variable    file attributes data

          flData is an uncompressed fldata_t struct.


         -MVS Extra Field:
          ===============

          The following is the layout of the file-attributes extra block for
          MVS.  The local-header and central-header versions are identical.
          (Last Revision 19960922)

          Value         Size        Description
          -----         ----        -----------
  (MVS)   0x470f        Short       tag for this extra block type
          TSize         Short       total data size for this block
          flData        variable    file attributes data

          flData is an uncompressed fldata_t struct.


         -PKWARE Unix Extra Field:
          ========================

          The following is the layout of PKWARE's Unix "extra" block.
          It was introduced with the release of PKZIP for Unix 2.50.
          Note: all fields are stored in Intel low-byte/high-byte order.
          (Last Revision 19980901)

          This field has a minimum data size of 12 bytes and is only stored
          as local extra field.

          Value         Size        Description
          -----         ----        -----------
 (Unix0)  0x000d        Short       Tag for this "extra" block type
          TSize         Short       Total Data Size for this block
          AcTime        Long        time of last access (UTC/GMT)
          ModTime       Long        time of last modification (UTC/GMT)
          UID           Short       Unix user ID
          GID           Short       Unix group ID
          (var)         variable    Variable length data field

          The variable length data field will contain file type
          specific data.  Currently the only values allowed are
          the original "linked to" file names for hard or symbolic
          links, and the major and minor device node numbers for
          character and block device nodes.  Since device nodes
          cannot be either symbolic or hard links, only one set of
          variable length data is stored.  Link files will have the
          name of the original file stored.  This name is NOT NULL
          terminated.  Its size can be determined by checking TSize -
          12.  Device entries will have eight bytes stored as two 4
          byte entries (in little-endian format).  The first entry
          will be the major device number, and the second the minor
          device number.

         [Info-ZIP note: The fixed part of this field has the same layout as
          Info-ZIP's abandoned "Unix1 timestamps & owner ID info" extra field;
          only the two tag bytes are different.]


         -PATCH Descriptor Extra Field:
          ============================

          The following is the layout of the Patch Descriptor "extra"
          block.

          Note: all fields stored in Intel low-byte/high-byte order.

          Value         Size        Description
          -----         ----        -----------
  (Patch) 0x000f        Short       Tag for this "extra" block type
          TSize         Short       Size of the total "extra" block
          Version       Short       Version of the descriptor
          Flags         Long        Actions and reactions (see below)
          OldSize       Long        Size of the file about to be patched
          OldCRC        Long        32-bit CRC of the file about to be patched
          NewSize       Long        Size of the resulting file
          NewCRC        Long        32-bit CRC of the resulting file


          Actions and reactions

          Bits          Description
          ----          ----------------
          0             Use for autodetection
          1             Treat as selfpatch
          2-3           RESERVED
          4-5           Action (see below)
          6-7           RESERVED
          8-9           Reaction (see below) to absent file
          10-11         Reaction (see below) to newer file
          12-13         Reaction (see below) to unknown file
          14-15         RESERVED
          16-31         RESERVED

          Actions

          Action       Value
          ------       -----
          none         0
          add          1
          delete       2
          patch        3

          Reactions

          Reaction     Value
          --------     -----
          ask          0
          skip         1
          ignore       2
          fail         3


         -PKCS#7 Store for X.509 Certificates:
          ===================================

          This field is contains the information about each
          certificate a file is signed with.  This field should only
          appear in the first central directory record, and will be
          ignored in any other record.

          Note: all fields stored in Intel low-byte/high-byte order.

          Value         Size        Description
          -----         ----        -----------
  (Store) 0x0014        2 bytes     Tag for this "extra" block type
          SSize         2 bytes     Size of the store data
          SData         (variable)  Data about the store

          SData
          Value         Size        Description
          -----         ----        -----------
          Version       2 bytes     Version number, 0x0001 for now
          StoreD        (variable)  Actual store data

          The StoreD member is suitable for passing as the pbData
          member of a CRYPT_DATA_BLOB to the CertOpenStore() function
          in Microsoft's CryptoAPI.  The SSize member above will be
          cbData + 6, where cbData is the cbData member of the same
          CRYPT_DATA_BLOB.  The encoding type to pass to
          CertOpenStore() should be
          PKCS_7_ANS_ENCODING | X509_ASN_ENCODING.


         -X.509 Certificate ID and Signature for individual file:
          ======================================================

          This field contains the information about which certificate
          in the PKCS#7 Store was used to sign the particular file.
          It also contains the signature data.  This field can appear
          multiple times, but can only appear once per certificate.

          Note: all fields stored in Intel low-byte/high-byte order.

          Value         Size        Description
          -----         ----        -----------
  (CID)   0x0015        2 bytes     Tag for this "extra" block type
          CSize         2 bytes     Size of Method
          Method        (variable)

          Method
          Value         Size        Description
          -----         ----        -----------
          Version       2 bytes     Version number, for now 0x0001
          AlgID         2 bytes     Algorithm ID used for signing
          IDSize        2 bytes     Size of Certificate ID data
          CertID        (variable)  Certificate ID data
          SigSize       2 bytes     Size of Signature data
          Sig           (variable)  Signature data

          CertID
          Value         Size        Description
          -----         ----        -----------
          Size1         4 bytes     Size of CertID, should be (IDSize - 4)
          Size1         4 bytes     A bug in version one causes this value
                                    to appear twice.
          IssSize       4 bytes     Issuer data size
          Issuer        (variable)  Issuer data
          SerSize       4 bytes     Serial Number size
          Serial        (variable)  Serial Number data

          The Issuer and IssSize members are suitable for creating a
          CRYPT_DATA_BLOB to be the Issuer member of a CERT_INFO
          struct. The Serial and SerSize members would be the
          SerialNumber member of the same CERT_INFO struct.  This
          struct would be used to find the certificate in the store
          the file was signed with.  Those structures are from the MS
          CryptoAPI.

          Sig and SigSize are the actual signature data and size
          generated by signing the file with the MS CryptoAPI using a
          hash created with the given AlgID.


         -X.509 Certificate ID and Signature for central directory:
          ========================================================

          This field contains the information about which certificate
          in the PKCS#7 Store was used to sign the central directory.
          It should only appear with the first central directory
          record, along with the store.  The data structure is the
          same as the CID, except that SigSize will be 0, and there
          will be no Sig member.

          This field is also kept after the last central directory
          record, as the signature data (ID 0x05054b50, it looks like
          a central directory record of a different type).  This
          second copy of the data is the Signature Data member of the
          record, and will have a SigSize that is non-zero, and will
          have Sig data.

          Note: all fields stored in Intel low-byte/high-byte order.

          Value         Size        Description
          -----         ----        -----------
  (CDID)  0x0016        2 bytes     Tag for this "extra" block type
          CSize         2 bytes     Size of Method
          Method       (variable)


         -ZIP64 Extended Information Extra Field:
          ======================================

          The following is the layout of the ZIP64 extended
          information "extra" block. If one of the size or
          offset fields in the Local or Central directory
          record is too small to hold the required data,
          a ZIP64 extended information record is created.
          The order of the fields in the ZIP64 extended
          information record is fixed, but the fields will
          only appear if the corresponding Local or Central
          directory record field is set to 0xFFFF or 0xFFFFFFFF.

          Note: all fields stored in Intel low-byte/high-byte order.

          Value      Size       Description
          -----      ----       -----------
  (ZIP64) 0x0001     2 bytes    Tag for this "extra" block type
          Size       2 bytes    Size of this "extra" block
          Original
          Size       8 bytes    Original uncompresseed file size
          Compressed
          Size       8 bytes    Size of compressed data
          Relative Header
          Offset     8 bytes    Offset of local header record
          Disk Start
          Number     4 bytes    Number of the disk on which
                                this file starts

          This entry in the Local header must include BOTH original
          and compressed file sizes.


         -Extended Timestamp Extra Field:
          ==============================

          The following is the layout of the extended-timestamp extra block.
          (Last Revision 19970118)

          Local-header version:

          Value         Size        Description
          -----         ----        -----------
  (time)  0x5455        Short       tag for this extra block type ("UT")
          TSize         Short       total data size for this block
          Flags         Byte        info bits
          (ModTime)     Long        time of last modification (UTC/GMT)
          (AcTime)      Long        time of last access (UTC/GMT)
          (CrTime)      Long        time of original creation (UTC/GMT)

          Central-header version:

          Value         Size        Description
          -----         ----        -----------
  (time)  0x5455        Short       tag for this extra block type ("UT")
          TSize         Short       total data size for this block
          Flags         Byte        info bits (refers to local header!)
          (ModTime)     Long        time of last modification (UTC/GMT)

          The central-header extra field contains the modification time only,
          or no timestamp at all.  TSize is used to flag its presence or
          absence.  But note:

              If "Flags" indicates that Modtime is present in the local header
              field, it MUST be present in the central header field, too!
              This correspondence is required because the modification time
              value may be used to support trans-timezone freshening and
              updating operations with zip archives.

          The time values are in standard Unix signed-long format, indicating
          the number of seconds since 1 January 1970 00:00:00.  The times
          are relative to Coordinated Universal Time (UTC), also sometimes
          referred to as Greenwich Mean Time (GMT).  To convert to local time,
          the software must know the local timezone offset from UTC/GMT.

          The lower three bits of Flags in both headers indicate which time-
          stamps are present in the LOCAL extra field:

                bit 0           if set, modification time is present
                bit 1           if set, access time is present
                bit 2           if set, creation time is present
                bits 3-7        reserved for additional timestamps; not set

          Those times that are present will appear in the order indicated, but
          any combination of times may be omitted.  (Creation time may be
          present without access time, for example.)  TSize should equal
          (1 + 4*(number of set bits in Flags)), as the block is currently
          defined.  Other timestamps may be added in the future.


         -Info-ZIP Unix Extra Field (type 1):
          ==================================

          The following is the layout of the old Info-ZIP extra block for
          Unix.  It has been replaced by the extended-timestamp extra block
          (0x5455) and the Unix type 2 extra block (0x7855).
          (Last Revision 19970118)

          Local-header version:

          Value         Size        Description
          -----         ----        -----------
  (Unix1) 0x5855        Short       tag for this extra block type ("UX")
          TSize         Short       total data size for this block
          AcTime        Long        time of last access (UTC/GMT)
          ModTime       Long        time of last modification (UTC/GMT)
          UID           Short       Unix user ID (optional)
          GID           Short       Unix group ID (optional)

          Central-header version:

          Value         Size        Description
          -----         ----        -----------
  (Unix1) 0x5855        Short       tag for this extra block type ("UX")
          TSize         Short       total data size for this block
          AcTime        Long        time of last access (GMT/UTC)
          ModTime       Long        time of last modification (GMT/UTC)

          The file access and modification times are in standard Unix signed-
          long format, indicating the number of seconds since 1 January 1970
          00:00:00.  The times are relative to Coordinated Universal Time
          (UTC), also sometimes referred to as Greenwich Mean Time (GMT).  To
          convert to local time, the software must know the local timezone
          offset from UTC/GMT.  The modification time may be used by non-Unix
          systems to support inter-timezone freshening and updating of zip
          archives.

          The local-header extra block may optionally contain UID and GID
          info for the file.  The local-header TSize value is the only
          indication of this.  Note that Unix UIDs and GIDs are usually
          specific to a particular machine, and they generally require root
          access to restore.

          This extra field type is obsolete, but it has been in use since
          mid-1994.  Therefore future archiving software should continue to
          support it.  Some guidelines:

              An archive member should either contain the old "Unix1"
              extra field block or the new extra field types "time" and/or
              "Unix2".

              If both the old "Unix1" block type and one or both of the new
              block types "time" and "Unix2" are found, the "Unix1" block
              should be considered invalid and ignored.

              Unarchiving software should recognize both old and new extra
              field block types, but the info from new types overrides the
              old "Unix1" field.

              Archiving software should recognize "Unix1" extra fields for
              timestamp comparison but never create it for updated, freshened
              or new archive members.  When copying existing members to a new
              archive, any "Unix1" extra field blocks should be converted to
              the new "time" and/or "Unix2" types.


         -Info-ZIP Unix Extra Field (type 2):
          ==================================

          The following is the layout of the new Info-ZIP extra block for
          Unix.  (Last Revision 19960922)

          Local-header version:

          Value         Size        Description
          -----         ----        -----------
  (Unix2) 0x7855        Short       tag for this extra block type ("Ux")
          TSize         Short       total data size for this block (4)
          UID           Short       Unix user ID
          GID           Short       Unix group ID

          Central-header version:

          Value         Size        Description
          -----         ----        -----------
  (Unix2) 0x7855        Short       tag for this extra block type ("Ux")
          TSize         Short       total data size for this block (0)

          The data size of the central-header version is zero; it is used
          solely as a flag that UID/GID info is present in the local-header
          extra field.  If additional fields are ever added to the local
          version, the central version may be extended to indicate this.

          Note that Unix UIDs and GIDs are usually specific to a particular
          machine, and they generally require root access to restore.


         -ASi Unix Extra Field:
          ====================

          The following is the layout of the ASi extra block for Unix.  The
          local-header and central-header versions are identical.
          (Last Revision 19960916)

          Value         Size        Description
          -----         ----        -----------
  (Unix3) 0x756e        Short       tag for this extra block type ("nu")
          TSize         Short       total data size for this block
          CRC           Long        CRC-32 of the remaining data
          Mode          Short       file permissions
          SizDev        Long        symlink'd size OR major/minor dev num
          UID           Short       user ID
          GID           Short       group ID
          (var.)        variable    symbolic link filename

          Mode is the standard Unix st_mode field from struct stat, containing
          user/group/other permissions, setuid/setgid and symlink info, etc.

          If Mode indicates that this file is a symbolic link, SizDev is the
          size of the file to which the link points.  Otherwise, if the file
          is a device, SizDev contains the standard Unix st_rdev field from
          struct stat (includes the major and minor numbers of the device).
          SizDev is undefined in other cases.

          If Mode indicates that the file is a symbolic link, the final field
          will be the name of the file to which the link points.  The file-
          name length can be inferred from TSize.

          [Note that TSize may incorrectly refer to the data size not counting
           the CRC; i.e., it may be four bytes too small.]


         -BeOS Extra Field:
          ================

          The following is the layout of the file-attributes extra block for
          BeOS.  (Last Revision 19970531)

          Local-header version:

          Value         Size        Description
          -----         ----        -----------
  (BeOS)  0x6542        Short       tag for this extra block type ("Be")
          TSize         Short       total data size for this block
          BSize         Long        uncompressed file attribute data size
          Flags         Byte        info bits
          (CType)       Short       compression type
          (CRC)         Long        CRC value for uncompressed file attribs
          Attribs       variable    file attribute data

          Central-header version:

          Value         Size        Description
          -----         ----        -----------
  (BeOS)  0x6542        Short       tag for this extra block type ("Be")
          TSize         Short       total data size for this block (5)
          BSize         Long        size of uncompr. local EF block data
          Flags         Byte        info bits

          The least significant bit of Flags in both headers indicates whether
          the LOCAL extra field is uncompressed (and therefore whether CType
          and CRC are omitted):

                bit 0           if set, Attribs is uncompressed (no CType, CRC)
                bits 1-7        reserved; if set, assume error or unknown data

          Currently the only supported compression types are deflated (type 8)
          and stored (type 0); the latter is not used by Info-ZIP's Zip but is
          supported by UnZip.

          Attribs is a BeOS-specific block of data in big-endian format with
          the following structure (if compressed, uncompress it first):

              Value     Size        Description
              -----     ----        -----------
              Name      variable    attribute name (null-terminated string)
              Type      Long        attribute type (32-bit unsigned integer)
              Size      Long Long   data size for this sub-block (64 bits)
              Data      variable    attribute data

          The attribute structure is repeated for every attribute.  The Data
          field may contain anything--text, flags, bitmaps, etc.


         -SMS/QDOS Extra Field:
          ====================

          The following is the layout of the file-attributes extra block for
          SMS/QDOS.  The local-header and central-header versions are identical.
          (Last Revision 19960929)

          Value         Size        Description
          -----         ----        -----------
  (QDOS)  0xfb4a        Short       tag for this extra block type
          TSize         Short       total data size for this block
          LongID        Long        extra-field signature
          (ExtraID)     Long        additional signature/flag bytes
          QDirect       64 bytes    qdirect structure

          LongID may be "QZHD" or "QDOS".  In the latter case, ExtraID will
          be present.  Its first three bytes are "02\0"; the last byte is
          currently undefined.

          QDirect contains the file's uncompressed directory info (qdirect
          struct).  Its elements are in native (big-endian) format:

          d_length      beLong          file length
          d_access      byte            file access type
          d_type        byte            file type
          d_datalen     beLong          data length
          d_reserved    beLong          unused
          d_szname      beShort         size of filename
          d_name        36 bytes        filename
          d_update      beLong          time of last update
          d_refdate     beLong          file version number
          d_backup      beLong          time of last backup (archive date)


         -AOS/VS Extra Field:
          ==================

          The following is the layout of the extra block for Data General
          AOS/VS.  The local-header and central-header versions are identical.
          (Last Revision 19961125)

          Value         Size        Description
          -----         ----        -----------
  (AOSVS) 0x5356        Short       tag for this extra block type ("VS")
          TSize         Short       total data size for this block
          "FCI\0"       Long        extra-field signature
          Version       Byte        version of AOS/VS extra block (10 = 1.0)
          Fstat         variable    fstat packet
          AclBuf        variable    raw ACL data ($MXACL bytes)

          Fstat contains the file's uncompressed fstat packet, which is one of
          the following:

                normal fstat packet             (P_FSTAT struct)
                DIR/CPD fstat packet            (P_FSTAT_DIR struct)
                unit (device) fstat packet      (P_FSTAT_UNIT struct)
                IPC file fstat packet           (P_FSTAT_IPC struct)

          AclBuf contains the raw ACL data; its length is $MXACL.


         -Tandem NSK Extra Field:
          ======================

          The following is the layout of the file-attributes extra block for
          Tandem NSK.  The local-header and central-header versions are
          identical.  (Last Revision 19981221)

          Value         Size        Description
          -----         ----        -----------
  (TA)    0x4154        Short       tag for this extra block type ("TA")
          TSize         Short       total data size for this block (20)
          NSKattrs      20 Bytes    NSK attributes


         -THEOS Extra Field:
          =================

          The following is the layout of the file-attributes extra block for
          Theos.  The local-header and central-header versions are identical.
          (Last Revision 19990206)

          Value         Size        Description
          -----         ----        -----------
  (Theos) 0x6854        Short       'Th' signature
          size          Short       size of extra block
          flags         Byte        reserved for future use
          filesize      Long        file size
          fileorg       Byte        type of file (see below)
          keylen        Short       key length for indexed and keyed files,
                                    data segment size for 16 bits programs
          reclen        Short       record length for indexed,keyed and direct,
                                    text segment size for 16 bits programs
          filegrow      Byte        growing factor for indexed,keyed and direct
          protect       Byte        protections (see below)
          reserved      Short       reserved for future use

            File types
            ==========

            0x80  library (keyed access list of files)
            0x40  directory
            0x10  stream file
            0x08  direct file
            0x04  keyed file
            0x02  indexed file
            0x0e  reserved
            0x01  16 bits real mode program (obsolete)
            0x21  16 bits protected mode program
            0x41  32 bits protected mode program

            Protection codes
            ================

            User protection
            ---------------
            0x01  non readable
            0x02  non writable
            0x04  non executable
            0x08  non erasable

            Other protection
            ----------------
            0x10  non readable
            0x20  non writable
            0x40  non executable Theos before 4.0
            0x40  modified Theos 4.x
            0x80  not hidden


         -THEOS old inofficial Extra Field:
          ================================

          The following is the layout of an inoffical former version of a
          Theos file-attributes extra blocks.  This layout was never published
          and is no longer created. However, UnZip can optionally support it
          when compiling with the option flag OLD_THEOS_EXTRA defined.
          Both the local-header and central-header versions are identical.
          (Last Revision 19990206)

          Value         Size        Description
          -----         ----        -----------
  (THS0)  0x4854        Short       'TH' signature
          size          Short       size of extra block
          flags         Short       reserved for future use
          filesize      Long        file size
          reclen        Short       record length for indexed,keyed and direct,
                                    text segment size for 16 bits programs
          keylen        Short       key length for indexed and keyed files,
                                    data segment size for 16 bits programs
          filegrow      Byte        growing factor for indexed,keyed and direct
          reserved      3 Bytes     reserved for future use


         -FWKCS MD5 Extra Field:
          =====================

          The FWKCS Contents_Signature System, used in automatically
          identifying files independent of filename, optionally adds
          and uses an extra field to support the rapid creation of
          an enhanced contents_signature.
          There is no local-header version; the following applies
          only to the central header.  (Last Revision 19961207)

          Central-header version:

          Value         Size        Description
          -----         ----        -----------
  (MD5)   0x4b46        Short       tag for this extra block type ("FK")
          TSize         Short       total data size for this block (19)
          "MD5"         3 bytes     extra-field signature
          MD5hash       16 bytes    128-bit MD5 hash of uncompressed data
                                    (low byte first)

          When FWKCS revises a .ZIP file central directory to add
          this extra field for a file, it also replaces the
          central directory entry for that file's uncompressed
          file length with a measured value.

          FWKCS provides an option to strip this extra field, if
          present, from a .ZIP file central directory. In adding
          this extra field, FWKCS preserves .ZIP file Authenticity
          Verification; if stripping this extra field, FWKCS
          preserves all versions of AV through PKZIP version 2.04g.

          FWKCS, and FWKCS Contents_Signature System, are
          trademarks of Frederick W. Kantor.

          (1) R. Rivest, RFC1321.TXT, MIT Laboratory for Computer
              Science and RSA Data Security, Inc., April 1992.
              ll.76-77: "The MD5 algorithm is being placed in the
              public domain for review and possible adoption as a
              standard."


      file comment: (Variable)

          The comment for this file.

      number of this disk: (2 bytes)

          The number of this disk, which contains central
          directory end record.  If an archive is in zip64 format
          and the value in this field is 0xFFFF, the size will
          be in the corresponding 4 byte zip64 end of central
          directory field.

      number of the disk with the start of the central directory: (2 bytes)

          The number of the disk on which the central
          directory starts.  If an archive is in zip64 format
          and the value in this field is 0xFFFF, the size will
          be in the corresponding 4 byte zip64 end of central
          directory field.

      total number of entries in the central dir on this disk: (2 bytes)

          The number of central directory entries on this disk.
          If an archive is in zip64 format and the value in
          this field is 0xFFFF, the size will be in the
          corresponding 8 byte zip64 end of central
          directory field.

      total number of entries in the central dir: (2 bytes)

          The total number of files in the .ZIP file.  If an
          archive is in zip64 format and the value in this field
          is 0xFFFF, the size will be in the corresponding 8 byte
          zip64 end of central directory field.

      size of the central directory: (4 bytes)

          The size (in bytes) of the entire central directory.
          If an archive is in zip64 format and the value in
          this field is 0xFFFFFFFF, the size will be in the
          corresponding 8 byte zip64 end of central
          directory field.

      offset of start of central directory with respect to
      the starting disk number:  (4 bytes)

          Offset of the start of the central directory on the
          disk on which the central directory starts.  If an
          archive is in zip64 format and the value in this
          field is 0xFFFFFFFF, the size will be in the
          corresponding 8 byte zip64 end of central
          directory field.

      .ZIP file comment length: (2 bytes)

          The length of the comment for this .ZIP file.

      .ZIP file comment: (Variable)

          The comment for this .ZIP file.

      zip64 extensible data sector    (variable size)

          (currently reserved for use by PKWARE)


  I.  General notes:

      1)  All fields unless otherwise noted are unsigned and stored
          in Intel low-byte:high-byte, low-word:high-word order.

      2)  String fields are not null terminated, since the
          length is given explicitly.

      3)  Local headers should not span disk boundaries.  Also, even
          though the central directory can span disk boundaries, no
          single record in the central directory should be split
          across disks.

      4)  The entries in the central directory may not necessarily
          be in the same order that files appear in the .ZIP file.

      5)  Spanned/Split archives created using PKZIP for Windows
          (V2.50 or greater), PKZIP Command Line (V2.50 or greater),
          or PKZIP Explorer will include a special spanning
          signature as the first 4 bytes of the first segment of
          the archive.  This signature (0x08074b50) will be
          followed immediately by the local header signature for
          the first file in the archive.  A special spanning
          marker may also appear in spanned/split archives if the
          spanning or splitting process starts but only requires
          one segment.  In this case the 0x08074b50 signature
          will be replaced with the temporary spanning marker
          signature of 0x30304b50.  Spanned/split archives
          created with this special signature are compatible with
          all versions of PKZIP from PKWARE.  Split archives can
          only be uncompressed by other versions of PKZIP that
          know how to create a split archive.

      6)  If one of the fields in the end of central directory
          record is too small to hold required data, the field
          should be set to -1 (0xFFFF or 0xFFFFFFFF) and the
          Zip64 format record should be created.

      7)  The end of central directory record and the
          Zip64 end of central directory locator record must
          reside on the same disk when splitting or spanning
          an archive.

UnShrinking - Method 1
----------------------

Shrinking is a Dynamic Ziv-Lempel-Welch compression algorithm
with partial clearing.  The initial code size is 9 bits, and
the maximum code size is 13 bits.  Shrinking differs from
conventional Dynamic Ziv-Lempel-Welch implementations in several
respects:

1)  The code size is controlled by the compressor, and is not
    automatically increased when codes larger than the current
    code size are created (but not necessarily used).  When
    the decompressor encounters the code sequence 256
    (decimal) followed by 1, it should increase the code size
    read from the input stream to the next bit size.  No
    blocking of the codes is performed, so the next code at
    the increased size should be read from the input stream
    immediately after where the previous code at the smaller
    bit size was read.  Again, the decompressor should not
    increase the code size used until the sequence 256,1 is
    encountered.

2)  When the table becomes full, total clearing is not
    performed.  Rather, when the compressor emits the code
    sequence 256,2 (decimal), the decompressor should clear
    all leaf nodes from the Ziv-Lempel tree, and continue to
    use the current code size.  The nodes that are cleared
    from the Ziv-Lempel tree are then re-used, with the lowest
    code value re-used first, and the highest code value
    re-used last.  The compressor can emit the sequence 256,2
    at any time.



Expanding - Methods 2-5
-----------------------

The Reducing algorithm is actually a combination of two
distinct algorithms.  The first algorithm compresses repeated
byte sequences, and the second algorithm takes the compressed
stream from the first algorithm and applies a probabilistic
compression method.

The probabilistic compression stores an array of 'follower
sets' S(j), for j=0 to 255, corresponding to each possible
ASCII character.  Each set contains between 0 and 32
characters, to be denoted as S(j)[0],...,S(j)[m], where m<32.
The sets are stored at the beginning of the data area for a
Reduced file, in reverse order, with S(255) first, and S(0)
last.

The sets are encoded as { N(j), S(j)[0],...,S(j)[N(j)-1] },
where N(j) is the size of set S(j).  N(j) can be 0, in which
case the follower set for S(j) is empty.  Each N(j) value is
encoded in 6 bits, followed by N(j) eight bit character values
corresponding to S(j)[0] to S(j)[N(j)-1] respectively.  If
N(j) is 0, then no values for S(j) are stored, and the value
for N(j-1) immediately follows.

Immediately after the follower sets, is the compressed data
stream.  The compressed data stream can be interpreted for the
probabilistic decompression as follows:


let Last-Character <- 0.
loop until done
    if the follower set S(Last-Character) is empty then
        read 8 bits from the input stream, and copy this
        value to the output stream.
    otherwise if the follower set S(Last-Character) is non-empty then
        read 1 bit from the input stream.
        if this bit is not zero then
            read 8 bits from the input stream, and copy this
            value to the output stream.
        otherwise if this bit is zero then
            read B(N(Last-Character)) bits from the input
            stream, and assign this value to I.
            Copy the value of S(Last-Character)[I] to the
            output stream.

    assign the last value placed on the output stream to
    Last-Character.
end loop


B(N(j)) is defined as the minimal number of bits required to
encode the value N(j)-1.


The decompressed stream from above can then be expanded to
re-create the original file as follows:


let State <- 0.

loop until done
    read 8 bits from the input stream into C.
    case State of
        0:  if C is not equal to DLE (144 decimal) then
                copy C to the output stream.
            otherwise if C is equal to DLE then
                let State <- 1.

        1:  if C is non-zero then
                let V <- C.
                let Len <- L(V)
                let State <- F(Len).
            otherwise if C is zero then
                copy the value 144 (decimal) to the output stream.
                let State <- 0

        2:  let Len <- Len + C
            let State <- 3.

        3:  move backwards D(V,C) bytes in the output stream
            (if this position is before the start of the output
            stream, then assume that all the data before the
            start of the output stream is filled with zeros).
            copy Len+3 bytes from this position to the output stream.
            let State <- 0.
    end case
end loop


The functions F,L, and D are dependent on the 'compression
factor', 1 through 4, and are defined as follows:

For compression factor 1:
    L(X) equals the lower 7 bits of X.
    F(X) equals 2 if X equals 127 otherwise F(X) equals 3.
    D(X,Y) equals the (upper 1 bit of X) * 256 + Y + 1.
For compression factor 2:
    L(X) equals the lower 6 bits of X.
    F(X) equals 2 if X equals 63 otherwise F(X) equals 3.
    D(X,Y) equals the (upper 2 bits of X) * 256 + Y + 1.
For compression factor 3:
    L(X) equals the lower 5 bits of X.
    F(X) equals 2 if X equals 31 otherwise F(X) equals 3.
    D(X,Y) equals the (upper 3 bits of X) * 256 + Y + 1.
For compression factor 4:
    L(X) equals the lower 4 bits of X.
    F(X) equals 2 if X equals 15 otherwise F(X) equals 3.
    D(X,Y) equals the (upper 4 bits of X) * 256 + Y + 1.


Imploding - Method 6
--------------------

The Imploding algorithm is actually a combination of two distinct
algorithms.  The first algorithm compresses repeated byte
sequences using a sliding dictionary.  The second algorithm is
used to compress the encoding of the sliding dictionary output,
using multiple Shannon-Fano trees.

The Imploding algorithm can use a 4K or 8K sliding dictionary
size. The dictionary size used can be determined by bit 1 in the
general purpose flag word; a 0 bit indicates a 4K dictionary
while a 1 bit indicates an 8K dictionary.

The Shannon-Fano trees are stored at the start of the compressed
file. The number of trees stored is defined by bit 2 in the
general purpose flag word; a 0 bit indicates two trees stored, a
1 bit indicates three trees are stored.  If 3 trees are stored,
the first Shannon-Fano tree represents the encoding of the
Literal characters, the second tree represents the encoding of
the Length information, the third represents the encoding of the
Distance information.  When 2 Shannon-Fano trees are stored, the
Length tree is stored first, followed by the Distance tree.

The Literal Shannon-Fano tree, if present is used to represent
the entire ASCII character set, and contains 256 values.  This
tree is used to compress any data not compressed by the sliding
dictionary algorithm.  When this tree is present, the Minimum
Match Length for the sliding dictionary is 3.  If this tree is
not present, the Minimum Match Length is 2.

The Length Shannon-Fano tree is used to compress the Length part
of the (length,distance) pairs from the sliding dictionary
output.  The Length tree contains 64 values, ranging from the
Minimum Match Length, to 63 plus the Minimum Match Length.

The Distance Shannon-Fano tree is used to compress the Distance
part of the (length,distance) pairs from the sliding dictionary
output. The Distance tree contains 64 values, ranging from 0 to
63, representing the upper 6 bits of the distance value.  The
distance values themselves will be between 0 and the sliding
dictionary size, either 4K or 8K.

The Shannon-Fano trees themselves are stored in a compressed
format. The first byte of the tree data represents the number of
bytes of data representing the (compressed) Shannon-Fano tree
minus 1.  The remaining bytes represent the Shannon-Fano tree
data encoded as:

    High 4 bits: Number of values at this bit length + 1. (1 - 16)
    Low  4 bits: Bit Length needed to represent value + 1. (1 - 16)

The Shannon-Fano codes can be constructed from the bit lengths
using the following algorithm:

1)  Sort the Bit Lengths in ascending order, while retaining the
    order of the original lengths stored in the file.

2)  Generate the Shannon-Fano trees:

    Code <- 0
    CodeIncrement <- 0
    LastBitLength <- 0
    i <- number of Shannon-Fano codes - 1   (either 255 or 63)

    loop while i >= 0
        Code = Code + CodeIncrement
        if BitLength(i) <> LastBitLength then
            LastBitLength=BitLength(i)
            CodeIncrement = 1 shifted left (16 - LastBitLength)
        ShannonCode(i) = Code
        i <- i - 1
    end loop


3)  Reverse the order of all the bits in the above ShannonCode()
    vector, so that the most significant bit becomes the least
    significant bit.  For example, the value 0x1234 (hex) would
    become 0x2C48 (hex).

4)  Restore the order of Shannon-Fano codes as originally stored
    within the file.

Example:

    This example will show the encoding of a Shannon-Fano tree
    of size 8.  Notice that the actual Shannon-Fano trees used
    for Imploding are either 64 or 256 entries in size.

Example:   0x02, 0x42, 0x01, 0x13

    The first byte indicates 3 values in this table.  Decoding the
    bytes:
            0x42 = 5 codes of 3 bits long
            0x01 = 1 code  of 2 bits long
            0x13 = 2 codes of 4 bits long

    This would generate the original bit length array of:
    (3, 3, 3, 3, 3, 2, 4, 4)

    There are 8 codes in this table for the values 0 thru 7.  Using
    the algorithm to obtain the Shannon-Fano codes produces:

                                  Reversed     Order     Original
Val  Sorted   Constructed Code      Value     Restored    Length
---  ------   -----------------   --------    --------    ------
0:     2      1100000000000000        11       101          3
1:     3      1010000000000000       101       001          3
2:     3      1000000000000000       001       110          3
3:     3      0110000000000000       110       010          3
4:     3      0100000000000000       010       100          3
5:     3      0010000000000000       100        11          2
6:     4      0001000000000000      1000      1000          4
7:     4      0000000000000000      0000      0000          4


The values in the Val, Order Restored and Original Length columns
now represent the Shannon-Fano encoding tree that can be used for
decoding the Shannon-Fano encoded data.  How to parse the
variable length Shannon-Fano values from the data stream is beyond
the scope of this document.  (See the references listed at the end of
this document for more information.)  However, traditional decoding
schemes used for Huffman variable length decoding, such as the
Greenlaw algorithm, can be successfully applied.

The compressed data stream begins immediately after the
compressed Shannon-Fano data.  The compressed data stream can be
interpreted as follows:

loop until done
    read 1 bit from input stream.

    if this bit is non-zero then       (encoded data is literal data)
        if Literal Shannon-Fano tree is present
            read and decode character using Literal Shannon-Fano tree.
        otherwise
            read 8 bits from input stream.
        copy character to the output stream.
    otherwise              (encoded data is sliding dictionary match)
        if 8K dictionary size
            read 7 bits for offset Distance (lower 7 bits of offset).
        otherwise
            read 6 bits for offset Distance (lower 6 bits of offset).

        using the Distance Shannon-Fano tree, read and decode the
          upper 6 bits of the Distance value.

        using the Length Shannon-Fano tree, read and decode
          the Length value.

        Length <- Length + Minimum Match Length

        if Length = 63 + Minimum Match Length
            read 8 bits from the input stream,
            add this value to Length.

        move backwards Distance+1 bytes in the output stream, and
        copy Length characters from this position to the output
        stream.  (if this position is before the start of the output
        stream, then assume that all the data before the start of
        the output stream is filled with zeros).
end loop

Tokenizing - Method 7
--------------------

This method is not used by PKZIP.

Deflating - Method 8
--------------------

The Deflate algorithm is similar to the Implode algorithm using
a sliding dictionary of up to 32K with secondary compression
from Huffman/Shannon-Fano codes.

The compressed data is stored in blocks with a header describing
the block and the Huffman codes used in the data block.  The header
format is as follows:

   Bit 0: Last Block bit     This bit is set to 1 if this is the last
                             compressed block in the data.
   Bits 1-2: Block type
      00 (0) - Block is stored - All stored data is byte aligned.
               Skip bits until next byte, then next word = block
               length, followed by the ones compliment of the block
               length word. Remaining data in block is the stored
               data.

      01 (1) - Use fixed Huffman codes for literal and distance codes.
               Lit Code    Bits             Dist Code   Bits
               ---------   ----             ---------   ----
                 0 - 143    8                 0 - 31      5
               144 - 255    9
               256 - 279    7
               280 - 287    8

               Literal codes 286-287 and distance codes 30-31 are
               never used but participate in the huffman construction.

      10 (2) - Dynamic Huffman codes.  (See expanding Huffman codes)

      11 (3) - Reserved - Flag a "Error in compressed data" if seen.

Expanding Huffman Codes
-----------------------
If the data block is stored with dynamic Huffman codes, the Huffman
codes are sent in the following compressed format:

   5 Bits: # of Literal codes sent - 257 (257 - 286)
           All other codes are never sent.
   5 Bits: # of Dist codes - 1           (1 - 32)
   4 Bits: # of Bit Length codes - 4     (4 - 19)

The Huffman codes are sent as bit lengths and the codes are built as
described in the implode algorithm.  The bit lengths themselves are
compressed with Huffman codes.  There are 19 bit length codes:

   0 - 15: Represent bit lengths of 0 - 15
       16: Copy the previous bit length 3 - 6 times.
           The next 2 bits indicate repeat length (0 = 3, ... ,3 = 6)
              Example:  Codes 8, 16 (+2 bits 11), 16 (+2 bits 10) will
                        expand to 12 bit lengths of 8 (1 + 6 + 5)
       17: Repeat a bit length of 0 for 3 - 10 times. (3 bits of length)
       18: Repeat a bit length of 0 for 11 - 138 times (7 bits of length)

The lengths of the bit length codes are sent packed 3 bits per value
(0 - 7) in the following order:

   16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15

The Huffman codes should be built as described in the Implode algorithm
except codes are assigned starting at the shortest bit length, i.e. the
shortest code should be all 0's rather than all 1's.  Also, codes with
a bit length of zero do not participate in the tree construction.  The
codes are then used to decode the bit lengths for the literal and
distance tables.

The bit lengths for the literal tables are sent first with the number
of entries sent described by the 5 bits sent earlier.  There are up
to 286 literal characters; the first 256 represent the respective 8
bit character, code 256 represents the End-Of-Block code, the remaining
29 codes represent copy lengths of 3 thru 258.  There are up to 30
distance codes representing distances from 1 thru 32k as described
below.

                             Length Codes
                             ------------
      Extra             Extra              Extra              Extra
 Code Bits Length  Code Bits Lengths  Code Bits Lengths  Code Bits Length(s)
 ---- ---- ------  ---- ---- -------  ---- ---- -------  ---- ---- ---------
  257   0     3     265   1   11,12    273   3   35-42    281   5  131-162
  258   0     4     266   1   13,14    274   3   43-50    282   5  163-194
  259   0     5     267   1   15,16    275   3   51-58    283   5  195-226
  260   0     6     268   1   17,18    276   3   59-66    284   5  227-258
  261   0     7     269   2   19-22    277   4   67-82    285   0    258
  262   0     8     270   2   23-26    278   4   83-98
  263   0     9     271   2   27-30    279   4   99-114
  264   0    10     272   2   31-34    280   4  115-130

                            Distance Codes
                            --------------
      Extra           Extra             Extra               Extra
 Code Bits Dist  Code Bits  Dist   Code Bits Distance  Code Bits Distance
 ---- ---- ----  ---- ---- ------  ---- ---- --------  ---- ---- --------
   0   0    1      8   3   17-24    16    7  257-384    24   11  4097-6144
   1   0    2      9   3   25-32    17    7  385-512    25   11  6145-8192
   2   0    3     10   4   33-48    18    8  513-768    26   12  8193-12288
   3   0    4     11   4   49-64    19    8  769-1024   27   12 12289-16384
   4   1   5,6    12   5   65-96    20    9 1025-1536   28   13 16385-24576
   5   1   7,8    13   5   97-128   21    9 1537-2048   29   13 24577-32768
   6   2   9-12   14   6  129-192   22   10 2049-3072
   7   2  13-16   15   6  193-256   23   10 3073-4096

The compressed data stream begins immediately after the
compressed header data.  The compressed data stream can be
interpreted as follows:

do
   read header from input stream.

   if stored block
      skip bits until byte aligned
      read count and 1's compliment of count
      copy count bytes data block
   otherwise
      loop until end of block code sent
         decode literal character from input stream
         if literal < 256
            copy character to the output stream
         otherwise
            if literal = end of block
               break from loop
            otherwise
               decode distance from input stream

               move backwards distance bytes in the output stream, and
               copy length characters from this position to the output
               stream.
      end loop
while not last block

if data descriptor exists
   skip bits until byte aligned
   check data descriptor signature
   read crc and sizes
endif

Deflate64 - Method 9
--------------------

[This description is inofficial.  It has been deduced by Info-ZIP from
close inspection of PKZIP 4.x Deflate64(tm) compressed output.]

The Deflate64 algorithm is almost identical to the normal Deflate algorithm.
Differences are:

- The sliding window size is 64k.

- The previously unused distance codes 30 and 31 are now used to describe
  match distances from 32k-48k and 48k-64k.
         Extra
    Code Bits Distance
    ---- ---- -----------
     ..   ..      ...
     29   13  24577-32768
     30   14  32769-49152
     31   14  49153-65536

- The semantics of the "maximum match length" code #258 has been changed to
  allow the specification of arbitrary large match lengths (up to 64k).
         Extra
    Code Bits Lengths
    ---- ---- ------
     ...  ..    ...
     284   5  227-258
     285  16  3-65538

Whereas the first two modifications fit into the framework of Deflate,
this last change breaks compatibility with Deflate method 8. Thus, a
Deflate64 decompressor cannot decode normal deflated data.


Decryption
----------

The encryption used in PKZIP was generously supplied by Roger
Schlafly.  PKWARE is grateful to Mr. Schlafly for his expert
help and advice in the field of data encryption.

PKZIP encrypts the compressed data stream.  Encrypted files must
be decrypted before they can be extracted.

Each encrypted file has an extra 12 bytes stored at the start of
the data area defining the encryption header for that file.  The
encryption header is originally set to random values, and then
itself encrypted, using three, 32-bit keys.  The key values are
initialized using the supplied encryption password.  After each byte
is encrypted, the keys are then updated using pseudo-random number
generation techniques in combination with the same CRC-32 algorithm
used in PKZIP and described elsewhere in this document.

The following is the basic steps required to decrypt a file:

1) Initialize the three 32-bit keys with the password.
2) Read and decrypt the 12-byte encryption header, further
   initializing the encryption keys.
3) Read and decrypt the compressed data stream using the
   encryption keys.


Step 1 - Initializing the encryption keys
-----------------------------------------

Key(0) <- 305419896
Key(1) <- 591751049
Key(2) <- 878082192

loop for i <- 0 to length(password)-1
    update_keys(password(i))
end loop


Where update_keys() is defined as:


update_keys(char):
  Key(0) <- crc32(key(0),char)
  Key(1) <- Key(1) + (Key(0) & 000000ffH)
  Key(1) <- Key(1) * 134775813 + 1
  Key(2) <- crc32(key(2),key(1) >> 24)
end update_keys


Where crc32(old_crc,char) is a routine that given a CRC value and a
character, returns an updated CRC value after applying the CRC-32
algorithm described elsewhere in this document.


Step 2 - Decrypting the encryption header
-----------------------------------------

The purpose of this step is to further initialize the encryption
keys, based on random data, to render a plaintext attack on the
data ineffective.


Read the 12-byte encryption header into Buffer, in locations
Buffer(0) thru Buffer(11).

loop for i <- 0 to 11
    C <- buffer(i) ^ decrypt_byte()
    update_keys(C)
    buffer(i) <- C
end loop


Where decrypt_byte() is defined as:


unsigned char decrypt_byte()
    local unsigned short temp
    temp <- Key(2) | 2
    decrypt_byte <- (temp * (temp ^ 1)) >> 8
end decrypt_byte


After the header is decrypted,  the last 1 or 2 bytes in Buffer
should be the high-order word/byte of the CRC for the file being
decrypted, stored in Intel low-byte/high-byte order, or the high-order
byte of the file time if bit 3 of the general purpose bit flag is set.
Versions of PKZIP prior to 2.0 used a 2 byte CRC check; a 1 byte CRC check is
used on versions after 2.0.  This can be used to test if the password
supplied is correct or not.


Step 3 - Decrypting the compressed data stream
----------------------------------------------

The compressed data stream can be decrypted as follows:


loop until done
    read a character into C
    Temp <- C ^ decrypt_byte()
    update_keys(temp)
    output Temp
end loop


Change Process
--------------

In order for the .ZIP file format to remain a viable definition, this
specification should be considered as open for periodic review and
revision.  Although this format was originally designed with a
certain level of extensibility, not all changes in technology
(present or future) were or will be necessarily considered in its
design.  If your application requires new definitions to the
extensible sections in this format, or if you would like to
submit new data structures, please forward your request to
zipformat@pkware.com.  All submissions will be reviewed by the
ZIP File Specification Committee for possible inclusion into
future versions of this specification.  Periodic revisions
to this specification will be published to ensure interoperability.


Acknowledgements
----------------

In addition to the above mentioned contributors to PKZIP and PKUNZIP,
I would like to extend special thanks to Robert Mahoney for suggesting
the extension .ZIP for this software.


References:

    Fiala, Edward R., and Greene, Daniel H., "Data compression with
       finite windows",  Communications of the ACM, Volume 32, Number 4,
       April 1989, pages 490-505.

    Held, Gilbert, "Data Compression, Techniques and Applications,
       Hardware and Software Considerations", John Wiley & Sons, 1987.

    Huffman, D.A., "A method for the construction of minimum-redundancy
       codes", Proceedings of the IRE, Volume 40, Number 9, September 1952,
       pages 1098-1101.

    Nelson, Mark, "LZW Data Compression", Dr. Dobbs Journal, Volume 14,
       Number 10, October 1989, pages 29-37.

    Nelson, Mark, "The Data Compression Book",  M&T Books, 1991.

    Storer, James A., "Data Compression, Methods and Theory",
       Computer Science Press, 1988

    Welch, Terry, "A Technique for High-Performance Data Compression",
       IEEE Computer, Volume 17, Number 6, June 1984, pages 8-19.

    Ziv, J. and Lempel, A., "A universal algorithm for sequential data
       compression", Communications of the ACM, Volume 30, Number 6,
       June 1987, pages 520-540.

    Ziv, J. and Lempel, A., "Compression of individual sequences via
       variable-rate coding", IEEE Transactions on Information Theory,
       Volume 24, Number 5, September 1978, pages 530-536.