Self-made C++ file archiver and archive extractor programs based on Huffman's lossless compression algorithm
You can check out documentation inside Compressor.cpp and Decompressor.cpp files to help you understand Huffman's algorithm's inner workings.
The Compressor
is a 2-pass program. What I mean by this is that the Compressor
reads input files twice.
In the first pass, the program counts usage frequency of every unique byte and creates a weighted translation tree for every used unique byte inversely proportional to its usage frequency and then writes this transformation info to the compressed file for decompression purposes
In the second pass, the program translates input files according to the translation tree and writes it to the newly created compressed file
The Decompressor
is a 1-pass program:
The Decompressor
first reads translation info and creates a binary tree from it. After this process is done, it uses this binary translation tree to decode the rest of the file
- Compile with
make
using your favourate shell:
make all
- After running make, you can use
archive
command below to compress the file you want:
- To compress one file use:
./archive {{filename}}
- To compress multiple files use:
./archive {{filename1}} {{filename2}} ...
- And to decompress a compressed file, use the
extract
command below:
./extract {{filename}}
- Version 2.0(Latest Version)
- Can compress any file and folder you want
- Useful for educative purposes
- Uses more functionalized structure
- Version 1.0
- Compresses multiple files
- Version 1.0 can not be used to compress folders
- Version 0.9
- Compresses 1 file at a time
- Version 0.9 can not be used to compress folders
- Easier to understand
- Useful for educative purposes