Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KatZip

A custom file compressor I created in order to learn c++ and better understand compression algorithms! It allows you to turn .txt files into .kat files.

Explanation

KatZip uses the huffman coding algorithm, which uses a Huffman tree where each leaf node corresponds to a character in the input data, and each internal node corresponds to the sum of the frequencies of the nodes.

This allows us to create a variable length codes where more often used letters have shorter codes allowing for smaller size files.

Geeks for Geeks example of Huffman Tree

Usage

In main.cpp file, use the following functions to encode a .txt file:

void encode(unordered_map<char, string> huffmanEncoding, string outputFile, string inputFile);
unordered_map<char, string> generateHash(string pathname);

You can also use the following function to decode a .txt file:

void decode(string inputPath, string outputPath);

Compression Example

On lorem ipsum 10 paragraph text:

Normal .txt size: 6123 bytes

Output.kat size: 3405 bytes

About

A custom file compressor I created in order to learn c++ and better understand compression algorithms! It allows you to turn .txt files into .kat files.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages