nso

Updated: 11 February 2020

NAME

NSO - NSO File Format

DESCRIPTION

The NSO format is a file format the uses the LZ-77 compression algorithm to compress a stream of data/text into an encoded version

It should be noted that this format is inefficient, and does not implement a solid LZ-77 compression algorithm.

The name "NSO" is an acronym derived from "Nagi Saleh Obeid."

THE FORMAT

**********

The format definition is as follows.

  1. A NSO file consists of a sequence of ASCII Characters that represent the original file name ending with a newline"\n"
  2. After the newline, each NSO file must contain a blank line and a newline"\n"
  3. 2 magic characters 7X are also requried in each NSO file, the two characters must come immedietly after the blank line and end in a newline"\n".
  4. 5 Random ASCII characters are generated and placed below the line containing the magic code.
  5. Without ending the 5 random ASCII characters with a new line, the LZ-77 codes will follow, and that will be the end of the file.

    Here is an example of a small image in this NSO file format

    filename
    
    7X
    &6^*$  (LZ-77 CODES*******************
    ***************************************
    ***************************************)
    

    Programs that read this format should not be too lenient and must be able to detect the magic CODE and the 5 Random ASCII CHARACTERS

    LZ-77 codes example:

    byte: offset
    byte: size of repeated data
    byte: next character



    The word "book" can be stored like this

    '0' '0' 'b' 3
    '0' '0' 'o' 3
    '1' '1' 'k' 3



    kcachegrind GUI Image

    nso valgrind