Skip to main content

lz77_compress

Function lz77_compress 

Source
pub fn lz77_compress(input: &[u8]) -> Vec<u8> ⓘ
Expand description

Compress a byte slice with a manual LZ77 sliding-window encoder.

The encoder scans the already-seen prefix of input and looks for the longest repeated substring that starts at the current position. When it finds a match of at least three bytes, it emits a back-reference token; otherwise it emits literal bytes.

The returned vector contains a small LZ77 header followed by the custom token stream described in the module-level documentation.