7z explained

7z file format
Extension:.7z
Mime:application/x-7z-compressed
Uniform Type:org.7-zip.7-zip-archive
Owner:Igor Pavlov[1]
Released:[2]
Genre:Data compression
Magic:'7', 'z', 0xBC, 0xAF, 0x27, 0x1C
Max Size:264 bytes (roughly 18 exabytes)
Open:Yes: GNU Lesser General Public License / Public domain

7z is a compressed archive file format that supports several different data compression, encryption and pre-processing algorithms. The 7z format initially appeared as implemented by the 7-Zip archiver. The 7-Zip program is publicly available under the terms of the GNU Lesser General Public License. The LZMA SDK 4.62 was placed in the public domain in December 2008. The latest stable version of 7-Zip and LZMA SDK is version 24.05.[2]

The official, informal 7z file format specification is distributed with 7-Zip's source code since 2015. The specification can be found in plain text format in the 'doc' sub-directory of the source code distribution.[3] There have been additional third-party attempts at writing more concrete documentation based on the released code.[4]

Features and enhancements

The 7z format provides the following main features:

The format's open architecture allows additional future compression methods to be added to the standard.

Compression methods

The following compression methods are currently defined:

A suite of recompression tools called AdvanceCOMP contains a copy of the DEFLATE encoder from the 7-Zip implementation; these utilities can often be used to further compress the size of existing gzip, ZIP, PNG, or MNG files.

Pre-processing filters

The LZMA SDK comes with the BCJ and BCJ2 preprocessors included, so that later stages are able to achieve greater compression: For x86, ARM, PowerPC (PPC), IA-64 Itanium, and ARM Thumb processors, jump targets are 'normalized' before compression by changing relative position into absolute values. For x86, this means that near jumps, calls and conditional jumps (but not short jumps and conditional jumps) are converted from the machine language "jump 1655 bytes backwards" style notation to normalized "jump to address 5554" style notation; all jumps to 5554, perhaps a common subroutine, are thus encoded identically, making them more compressible.

Similar executable pre-processing technology is included in other software; the RAR compressor features displacement compression for 32-bit x86 executables and IA-64 executables, and the UPX runtime executable file compressor includes support for working with 16-bit values within DOS binary files.

Encryption

The 7z format supports encryption with the AES algorithm with a 256-bit key. The key is generated from a user-supplied passphrase using an algorithm based on the SHA-256 hash function. The SHA-256 is executed 219 (524288) times,[6] which causes a significant delay on slow PCs before compression or extraction starts. This technique is called key stretching and is used to make a brute-force search for the passphrase more difficult. Current GPU-based, and custom hardware attacks limit the effectiveness of this particular method of key stretching,[7] so it is still important to choose a strong password.The 7z format provides the option to encrypt the filenames of a 7z archive.

Limitations

The 7z format does not store filesystem permissions (such as UNIX owner/group permissions or NTFS ACLs), and hence can be inappropriate for backup/archival purposes. A workaround on UNIX-like systems for this is to convert data to a tar bitstream before compressing with 7z. But GNU tar (common in many UNIX environments) can also compress with the LZMA2 algorithm ("xz") natively, without the use of 7z, using the "-J" switch. The resulting file extension is ".tar.xz" or ".txz" and not ".tar.7z". This method of compression has been adopted with many distributions for packaging, such as Arch, Debian (deb), Fedora (rpm) and Slackware. (The older "lzma" format is less efficient.)[8] On the other hand, it is important to note, that tar does not save the filesystem encoding, which means that tar compressed filenames can become unreadable if decompressed on a different computer.

The 7z format does not allow extraction of some "broken files"—that is (for example) if one has the first segment of a series of 7z files, 7z cannot give the start of the files within the archive—it must wait until all segments are downloaded. The 7z format also lacks recovery records, making it vulnerable to data degradation unless used in conjunction with external solutions, like parchives, or within filesystems with robust error-correction. By way of comparison, zip files also lack a recovery feature while the rar format has one.

See also

Further reading

Notes and References

  1. Web site: A Few Questions for Igor Pavlov . 2003-04-30 . Dr. Dobb's Data Compression Newsletter . 2009-12-26 . 28 October 2008 . https://web.archive.org/web/20081028091651/http://www.ddj.com/architect/184405338 . live .
  2. Web site: History of 7-zip changes . 10 June 2010 . 27 February 2015 . https://web.archive.org/web/20150227213935/http://www.7-zip.org/history.txt . live .
  3. LZMA SDK, "DOC" directory, 7zFormat.txt
  4. Web site: .7z format specification — py7zr – 7-zip archive library . py7zr.readthedocs.io.
  5. Web site: lzma_.lzma. liblzma bindings. Lasse. Collin. 2010-01-03. Compared to LZMA1, LZMA2 adds support for LZMA_SYNC_FLUSH, uncompressed chunks (smaller expansion when trying to compress uncompressible data), possibility to change lc/lp/pb in the middle of encoding, and some other internal improvements.. https://web.archive.org/web/20100208075245/https://www.google.com/codesearch/p?hl=en. 8 February 2010 . live.
  6. Web site: 7-zip source code . 23 March 2018 . 22 March 2019 . https://web.archive.org/web/20190322095659/https://sourceforge.net/projects/sevenzip/?source=directory . live .
  7. [Colin Percival]
  8. Web site: GNU tar 1.34: 8.1 Using Less Space through Compression. 17 March 2015. 2 April 2015. https://web.archive.org/web/20150402103628/https://www.gnu.org/software/tar/manual/html_section/Compression.html. live.