Static Huffman Encoder / Decoder
|
There is a lot of good information on Static Huffman Encoding on the web. There are
several code examples as well. I was unable, however, to find a VBScript version.
VBScript may not be the optimum language to create a Static Huffman Encoder, but it
suited my purposes because my Web Host Provider does not allow compiled code on his
server.
The encoder requires a "weight file" which is a list of letters with a weighting, or the number of times it occurred within a sample. The Static Huffman Encoder available on this site uses the US Constitution to create it's tree. This works fairly well for standard written text, but is rather inefficient for programming code. I first created a script to tally the weight of characters in a sample. This is the Huffman Weight Indexer. I created a few weight indexes based upon different well known texts. Then I created a HuffmanEncode() and HuffmanDecode() function. Both require the building of a Huffman tree based upon the weight file. These are part of an include file than can be added to any VBScript ASP file. Test the Static Huffman Encoder here. |
Static Huffman Encoder / Decoder is written entirely in VBScript (ASP) running on IIS by Anthony J. Garot.
Send suggestions for improving Static Huffman Encoder / Decoder here. Interested in reviewing the code? Ask here by specifying your interest/use for the code. |