\

CLZ

Author: Charles Bonoan
Updated: 2/9/2021

DESCRIPTION

This program is designed to compress text files using the LZ-77 algorithm.


Although this algorithm is not the most efficient in terms of actually getting compression, it is simple to implement the algorithm in order to compress a file and also easy to decompress the file given the right file specifications despite the compressed file containing information the human eye cannot detect.


FILE FORMAT

The format definition is as follows. Use this definition in order to interpret and decode the compressed file accurately.


Each compressed file will have the file extension ".clz", and below each file will contain the following.

  1. The name of the uncompressed file.
  2. The usize of uncompressed file in bytes.
  3. Every three bytes after will be grouped in this order - < offset > < length > < character > - each described below
    Offset
    - Represents the number of positions to move backwards in the text to find the start of a matching string.
    Length
    - Represents the amount of characters to copy after moving backwards in the text offset times.
    Character
    - Represents the character to print after copying length characters.

Here is an example of what a file's contents might look like if we were trying to compress a file that has the text "The computerphile channel handles computer topics":

KCACHEGRIND SCREENSHOT