Skip to content

A python implementation of huffman coding

License

Notifications You must be signed in to change notification settings

Rijkaron/huffman

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Huffman

Huffman coding is a general purpose lossless compression algorithm developed by David A. Huffman (Wikipedia)

Installation

This project requires python 3.5+. Install it from https://www.python.org/downloads

How does it work

I would recommend watching Tom Scott's video on Huffman trees to learn how they work.

How Computers Compress Text: Huffman Coding and Huffman Trees

Compressed file layout

The compressed Huffman files are structured as follows (format is {name|size of the value in bits}):

{amount_of_codes|8} -> The amount of codes 
{length_of_code_length|8} -> The length of the value with the length of the code
for every code:
  {byte|8} -> 
  {length_of_code|length_of_code_length}
  {code|length_of_code} -> The byte,
{length_of_the_filler_bits|3} -> The amount of bits that are used to fill the last byte and shouldn't be read when decompressing
{compressed_data|unknown} -> The actual compressed data

License

MIT

About

A python implementation of huffman coding

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages