Skip to content

Catoverflow/Huffman-Compress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 

Repository files navigation

Huffman Compression

Codacy Badge

Usage

huffman [options] source [target]

Options:

-u uncompress file

-z compress file (by default)

-r rename output (should be used with target specified, ${source}.huff by default)

Examples:

huffman -u zip.huff

huffman -zr code.txt code.huff

Details

.huff File Formatting

Dictionary Size

8bit(char)

File Structure:

Header Data

Header Structure:

Header
tree size node 1 node 2 ... node n
huff code length huff code block 1 huff code block 2 ... margin part for last block huff code block (m+7)/8 source code
n-1 (8bit) m(8bit) 8bit 8bit -m mod8 bit m mod8 bit 8bit

Data Structure:

Data
huffman bitstream alignment alignment size
a bit a(8bit)

Acknowledgement

First submitted by Catoverflow, as experiment homework for data structure class :3

About

Compress file using huffman-encoding

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages