Huffman Encoder using python.
In 2004, as a lark, I created a Huffman Encoder web page using VBscript/ASP. I found the code on an old CD-R and decided to migrate it to python.
It's an encoding mechanism whereby a tree of nodes is formed from a source text, then strings can be encoded using that tree to potentially make the string smaller.
The nodes are typically binary, 1 and 0.
As an example:
Just a simple test.
coverts into
000011111110000001010111111000111001000010011111101010100100101111011010001010110000001
While that seems to be longer, the binary can be converted into characters, so the actual length is the binary stream divided by 8.
- lossless compression
- obfuscate a string