torrentzip
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
torrentzip [2022/01/30 14:35] – johnsanc | torrentzip [2022/11/20 11:07] (current) – johnsanc | ||
---|---|---|---|
Line 4: | Line 4: | ||
This specification is intended to define the implementation of zip as used by the TorrentZip standard. | This specification is intended to define the implementation of zip as used by the TorrentZip standard. | ||
- | ===== Archive | + | ===== Archive |
==== General format of a torrentzipped .zip file with n files: ==== | ==== General format of a torrentzipped .zip file with n files: ==== | ||
- | ^Files - Start^ | + | ^Archive |
|[local file header 1]| | |[local file header 1]| | ||
|[file data 1]| | |[file data 1]| | ||
Line 22: | Line 22: | ||
^Central Directory - End (EOCD file offset)^ | ^Central Directory - End (EOCD file offset)^ | ||
|[end of central directory record]| | |[end of central directory record]| | ||
+ | ^Archive End^ | ||
Line 27: | Line 28: | ||
^Type ^Attribute ^Value ^Description ^ | ^Type ^Attribute ^Value ^Description ^ | ||
|UInt32|Local file header signature|(0x04034b50)| | | |UInt32|Local file header signature|(0x04034b50)| | | ||
- | |UInt16|Version needed to extract|20|File is compressed using Deflate compression| | + | |UInt16|Version needed to extract|20 |
- | |UInt16|General purpose bit flag|2|Maximum compression option was used| | + | |UInt16|General purpose bit flag|2|Maximum compression option was used, bit 11 (0x800) is set for unicode filename| |
|UInt16|Compression method|8|The file is Deflated| | |UInt16|Compression method|8|The file is Deflated| | ||
|UInt16|Last mod file time|48128|11: | |UInt16|Last mod file time|48128|11: | ||
Line 36: | Line 37: | ||
|UInt32|Uncompressed size| |File Uncompressed Size| | |UInt32|Uncompressed size| |File Uncompressed Size| | ||
|UInt16|Filename length| |Filename length| | |UInt16|Filename length| |Filename length| | ||
- | |UInt16|Extra field length|0|No extra field information| | + | |UInt16|Extra field length| |Normally 0, Length of Extra field data if zip64 extra field information |
|Byte[]|Filename (variable size)| |Byte array of filename| | |Byte[]|Filename (variable size)| |Byte array of filename| | ||
- | |**ⓘ NOTE:** \\ The default values show are required to have consistent torrentzipped files. Default time/date of 11:32pm 12/24/1996 is the date of the first ever MAME release.| | + | <WRAP info>The default values show are required to have consistent torrentzipped files. Default time/date of 11:32pm 12/24/1996 is the date of the first ever MAME release.</ |
==== File data x: ==== | ==== File data x: ==== | ||
Line 50: | Line 51: | ||
|UInt32|Central file header signature|(0x02014b50)| | | |UInt32|Central file header signature|(0x02014b50)| | | ||
|UInt16|Version made by|0|MS_DOS and OS/2 (FAT/FAT32 file systems)| | |UInt16|Version made by|0|MS_DOS and OS/2 (FAT/FAT32 file systems)| | ||
- | |UInt16|Version needed to extract|20|File is compressed using Deflate compression| | + | |UInt16|Version needed to extract|20 |
- | |UInt16|General purpose bit flag|2|Maximum compression option was used| | + | |UInt16|General purpose bit flag|2|Maximum compression option was used, bit 11 (0x800) is set for unicode filename| |
|UInt16|Compression method|8|The file is Deflated| | |UInt16|Compression method|8|The file is Deflated| | ||
|UInt16|Last mod file time|48128|11: | |UInt16|Last mod file time|48128|11: | ||
Line 59: | Line 60: | ||
|UInt32|Uncompressed size| |File Uncompressed Size| | |UInt32|Uncompressed size| |File Uncompressed Size| | ||
|UInt16|File name length| |Filename length| | |UInt16|File name length| |Filename length| | ||
- | |UInt16|Extra field length|0|No extra field information| | + | |UInt16|Extra field length| |Normally 0, Length of Extra field data if zip64 extra field information |
|UInt16|File comment length|0|No file comment| | |UInt16|File comment length|0|No file comment| | ||
|UInt16|Disk number start|0|Multi disk storage not used so set to disk 0| | |UInt16|Disk number start|0|Multi disk storage not used so set to disk 0| | ||
Line 67: | Line 68: | ||
|Byte[]|File name (variable size)| |Byte array of filename| | |Byte[]|File name (variable size)| |Byte array of filename| | ||
- | ==== End Of Central Directory: ==== | + | ==== End of Central Directory: ==== |
^Type ^Attribute ^Value ^Description ^ | ^Type ^Attribute ^Value ^Description ^ | ||
|UInt32|End of central dir signature|(0x06054b50)| | | |UInt32|End of central dir signature|(0x06054b50)| | | ||
Line 79: | Line 80: | ||
|Byte[22]|.ZIP file comment|TORRENTZIPPED-XXXXXXXX| | | |Byte[22]|.ZIP file comment|TORRENTZIPPED-XXXXXXXX| | | ||
- | |**ⓘ NOTE:** \\ See above ' | + | <WRAP info>See above ' |
- | ===== The TorrentZipped | + | ===== The TorrentZipped |
- | The .ZIP file comments | + | The .ZIP file comment |
- | The comment must be formatted as the 22 bytes of '' | + | The comment must be formatted as the 22 bytes of '' |
This comment ensures that if any change is made to the files within the zip this checksum will no longer match the byte data in the central directory, and in this way we can check the validity of a torrentzip file. | This comment ensures that if any change is made to the files within the zip this checksum will no longer match the byte data in the central directory, and in this way we can check the validity of a torrentzip file. | ||
+ | ===== Filename Encoding ===== | ||
+ | The filenames of the compressed files in a zip file are stored in the local header and the central directory as byte arrays. Zip was original build on early IBM PCs, and as such uses [[https:// | ||
- | ===== File Order with a TorrentZip ===== | + | |
+ | ===== File order with a TorrentZip ===== | ||
For the creation of consistent torrentzipped files, the file order is also very important. Files must be sorted by filename using a lower case sort. | For the creation of consistent torrentzipped files, the file order is also very important. Files must be sorted by filename using a lower case sort. | ||
Line 97: | Line 101: | ||
This leads to a possible naming inconsistency. The zip file format states: //"All slashes should be forward slashes ‘/’ as opposed to backwards slashes ‘\’"// | This leads to a possible naming inconsistency. The zip file format states: //"All slashes should be forward slashes ‘/’ as opposed to backwards slashes ‘\’"// | ||
- | ===== Directory | + | ===== Directory |
A directory entry is stored in a zip by adding a file entry ending in a directory separator character with a zero size and CRC. So directory '' | A directory entry is stored in a zip by adding a file entry ending in a directory separator character with a zero size and CRC. So directory '' | ||
Line 109: | Line 113: | ||
kept to create the empty directory, as removing it would completely remove the '' | kept to create the empty directory, as removing it would completely remove the '' | ||
- | ===== Repeat | + | ===== Repeat |
Another test that could be performed is checking for repeat file entries inside the zip, most zip programs have a hard time handling this and will just ignore this repeat giving the user no way of knowing there is a repeat filename problem. So it would fix another possible inconsistency if torrentzip scanning at least warned about repeat filename being found inside a zip. | Another test that could be performed is checking for repeat file entries inside the zip, most zip programs have a hard time handling this and will just ignore this repeat giving the user no way of knowing there is a repeat filename problem. So it would fix another possible inconsistency if torrentzip scanning at least warned about repeat filename being found inside a zip. | ||
Line 115: | Line 119: | ||
* [[http:// | * [[http:// | ||
* [[http:// | * [[http:// | ||
- | * [[http:// | + | * [[http:// |
torrentzip.txt · Last modified: 2022/11/20 11:07 by johnsanc