Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

LZVN compressed data format

LZVN compression is used in various data formats used on Mac OS, including Apple File System Compression (decmpfs), which is used in Hierarchical File System (HFS) and Apple File System (APFS).

Overview

LZVN compressed data consist of:

Characteristics

CharacteristicsDescription
Byte orderbig-endian

Opcodes

The opcodes consist of:

OppcodeDataDescription
0xe011100000 LLLLLLLL <literal>Large literal of size: L + 16
0xe1 - 0xef1110LLLL <literal>Small literal of size: L
0x00 - 0x05, 0x08 - 0x0d, 0x10 - 0x15, 0x18 - 0x1d, 0x20 - 0x25, 0x28 - 0x2d, 0x30 - 0x35, 0x38 - 0x3d, 0x40 - 0x45, 0x48 - 0x4d, 0x50 - 0x55, 0x58 - 0x5d, 0x60 - 0x65, 0x68 - 0x6d, 0x80 - 0x85, 0x88 - 0x8d, 0x90 - 0x95, 0x98 - 0x9d, 0xc0 - 0xc5, 0xc8 - 0xcdLLMMMDDD DDDDDDDD <literal>Small distance: M + 3
0xa0 - 0xbf101LLMMM DDDDDDMM DDDDDDDD <literal>Medium distance: M + 3
0x07, 0x0f, 0x17, 0x1f, 0x27, 0x2f, 0x37, 0x3f, 0x47, 0x4f, 0x57, 0x5f, 0x67, 0x6f, 0x87, 0x8f, 0x97, 0x9f, 0xc7, 0xcfLLMMM111 DDDDDDDD DDDDDDDD <literal>Large distance: M + 3
0x46, 0x4e, 0x56, 0x5e, 0x66, 0x6e, 0x86, 0x8e, 0x96, 0x9e, 0xc6, 0xceLLMMM110Previous distance
0x0e, 0x16None (nop)
0x06End of stream (eos)
0xf1 - 0xff1111MMMMSmall match
0xf011110000 MMMMMMMMLarge match: M + 16
0x1e, 0x26, 0x2e, 0x36, 0x3e, 0x70 - 0x7f, 0xd0 - 0xdfInvalid