LZMA (.lzma)

The legacy LZMA-alone stream format.

Overview

The LZMA-alone format has a 13-byte header: one properties byte (lc, lp, pb), a 32-bit dictionary size and a 64-bit uncompressed size (or all ones for unknown size, ending with an end marker), followed by the range-coded stream. There is no checksum.

Where it is used

  • Legacy compressed files and embedded firmware.

History

  • Introduced by Igor Pavlov with 7-Zip; superseded by XZ.

Status today

  • Legacy, still handled by many tools.

Structures read by the implementation

Offsets are in bytes from the start of the buffer named in each heading. Field names are taken from the implementation and are not an official specification. Fixed-width integers are shown as u/i (unsigned/signed) followed by bit width and byte order.

LzmaAloneArchiveModule.Mount buffer h · LzmaAloneArchiveModule.cs

OffsetSizeTypeFieldNotes
0x01u8–
0x58u64 LEUncompressed

LzmaAloneArchiveModule.Probe buffer h · LzmaAloneArchiveModule.cs

OffsetSizeTypeFieldNotes
0x01u8–
0x11u8Dict Size
0x21u8Dict Size
0x31u8Dict Size
0x41u8Dict Size
0x58u64 LEUncompressed

RangeDecoder.DecompressAlone buffer src · LzmaDecoder.cs

OffsetSizeTypeFieldNotes
0x01u8–
0x58u64 LESize

Other fields read

Read inOffsetSizeTypeFieldNotes
RangeDecoderstart + 14u32 BECode

Constants

General LzmaDecoder

NameValueTypeNotes
States12int
ProbInit1024int

General LzmaAloneArchiveModule

NameValueTypeNotes
HeaderSize13int

Implementation limits reader

ClassNameValueNotes
LzmaAloneArchiveModuleMaxUnknownSizeOutput1 << 30
LzmaAloneArchiveModuleEagerSizeLimit32L * 1024 * 1024
Structures and constants were extracted from: IO/Compression/LzmaDecoder.cs, Modules/FileSystems/LzmaAloneArchiveModule.cs. Prose sections are a summary from public sources; verify details before relying on them.