LZ4

From Just Solve the File Format Problem
(Difference between revisions)
Jump to: navigation, search
(Resources)
(Updated FormatInfo, updated links, added examples where lz4 is used under Linux and citations, added Wikipedia page.)
Line 3: Line 3:
 
|subcat=Compression
 
|subcat=Compression
 
|extensions={{ext|lz4}}
 
|extensions={{ext|lz4}}
 +
|wikidata={{wikidata|Q15624241}} (Compression algorithm)<br />{{wikidata|Q28770292}} (file format)
 +
|compression=lossless, mandatory
 +
|magic=02 21 4c 18 (legacy)<br />04 22 4d 18
 
|released=2011
 
|released=2011
 
}}
 
}}
 
'''LZ4''' is a lossless data compression algorithm and compressed data format. It is designed to support very fast compression.
 
'''LZ4''' is a lossless data compression algorithm and compressed data format. It is designed to support very fast compression.
 +
 +
In [[Linux]], LZ4 appears as one of the many compression format for:
 +
* [[vmlinuz]]<ref>[https://github.com/torvalds/linux/blob/master/scripts/extract-vmlinux#L56 extract-vmlinux shell script (line 56) - Linus Torvalds' kernel - GitHub]</ref>
 +
* [[initramfs]]<ref>[https://github.com/dracut-ng/dracut-ng/blob/main/man/dracut.conf.5.adoc?plain=1#L119-L123 dracut.conf.5.adoc - dracut-ng manual pages - GitHub]</ref><ref>[https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio/-/blob/master/mkinitcpio.conf?ref_type=heads#L61-67 mkinitcpio.conf (lines 61-67) - mkinitcpio - Arch Linux GitLab]</ref><ref>[https://github.com/anatol/booster/blob/master/docs/manpage.md?plain=1#L57 manpage.md (line 57) - booster - GitHub]</ref>
 +
* [[SquashFS|<code>squashfs-tools</code>]]<ref>[https://github.com/plougher/squashfs-tools/blob/master/squashfs-tools/compressor.c#L31-L77 compressor.c (lines 31-77) - squashfs-tools - GitHub]</ref>
 +
* zram<ref>[https://docs.kernel.org/admin-guide/blockdev/zram.html#select-compression-algorithm 2) Select compression algorithm - zram: Compressed RAM-based block devices -- The Linux Kernel documentation]</ref> - Compressed RAM-based block devices.
  
 
== Identification ==
 
== Identification ==
When used as a file format, LZ4 files begin with signature bytes <code>04 22 4d 18</code>.
+
When used as a file format, LZ4 files begin with signature bytes {{magic|04 22 4d 18}}.
  
There is also a legacy format, whose signature is <code>02 21 4c 18</code>.
+
There is also a legacy format, whose signature is {{magic|02 21 4c 18}}.
  
 
== Resources ==
 
== Resources ==
 +
* [[wikipedia:LZ4 (compression algorithm)| LZ4 compression algorithm on Wikipedia]]
 
* [https://github.com/Cyan4973/lz4 LZ4 website]
 
* [https://github.com/Cyan4973/lz4 LZ4 website]
* [http://fastcompression.blogspot.com/2011/05/lz4-explained.html LZ4 explained]
+
* [https://fastcompression.blogspot.com/2011/05/lz4-explained.html LZ4 explained]
 
* [https://ticki.github.io/blog/how-lz4-works/ How LZ4 works]
 
* [https://ticki.github.io/blog/how-lz4-works/ How LZ4 works]
 
* [http://blog.securitymouse.com/2014/06/raising-lazarus-20-year-old-bug-that.html Raising Lazarus - The 20 Year Old Bug that Went to Mars] vs. [http://fastcompression.blogspot.com/2014/06/debunking-lz4-20-years-old-bug-myth.html Debunking the LZ4 "20 years old bug" myth]
 
* [http://blog.securitymouse.com/2014/06/raising-lazarus-20-year-old-bug-that.html Raising Lazarus - The 20 Year Old Bug that Went to Mars] vs. [http://fastcompression.blogspot.com/2014/06/debunking-lz4-20-years-old-bug-myth.html Debunking the LZ4 "20 years old bug" myth]
 +
 +
== References ==
 +
<references/>

Revision as of 08:36, 16 August 2025

File Format
Name LZ4
Ontology
Extension(s) .lz4
Wikidata ID Q15624241 (Compression algorithm)
Q28770292 (file format)
Compression lossless, mandatory
Magic Bytes 02 21 4c 18 (legacy)
04 22 4d 18
Released 2011

LZ4 is a lossless data compression algorithm and compressed data format. It is designed to support very fast compression.

In Linux, LZ4 appears as one of the many compression format for:

Identification

When used as a file format, LZ4 files begin with signature bytes 04 22 4d 18.

There is also a legacy format, whose signature is 02 21 4c 18.

Resources

References

  1. extract-vmlinux shell script (line 56) - Linus Torvalds' kernel - GitHub
  2. dracut.conf.5.adoc - dracut-ng manual pages - GitHub
  3. mkinitcpio.conf (lines 61-67) - mkinitcpio - Arch Linux GitLab
  4. manpage.md (line 57) - booster - GitHub
  5. compressor.c (lines 31-77) - squashfs-tools - GitHub
  6. 2) Select compression algorithm - zram: Compressed RAM-based block devices -- The Linux Kernel documentation
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox