README.md

December 5, 2022 · View on GitHub

Huffman Compression Algorithm (like WinZIP)

Description

PKZIP, ARJ, ARC, JPEG, and a host of other programs and compressed file formats all use the Huffman coding algorithm (or similar redundancy-minimization methods) for compressing strings.

With this small VB module, you can do your own compression in code -- compressing strings down to as small as 13%. Here's how easy it is:

        Compressed = HuffmanEncode(Text1)


        Text2 = HuffmanDecode(Compressed)

This simple code can be used to compress big text fields in databases, keep your data files small, or speed up transfers of data across the Internet. It can also be used as a form of encryption.

The HuffmanCoding.bas module has plenty of extra information and some in-code documentation (in case you're wondering out how it works.)

Please comment on this code and vote for my hard work if you like this code.



Updates:

1 August 2000:

  • Rebuilt from scratch
  • Compression takes 28% of the time it did before
  • Decompression takes 19% of the time it did before
  • There's only one file, now (no extra class)
  • Much better error checking and reporting
  • Uses a stored checksum upon decompression to check for corruption
  • The code is only 455 lines, including comments!
  • Thanks to optimization, the code is even more convoluted :-)

    More Info

    Submitted On2000-08-02 08:06:10
    ByJames Vincent Carnicelli
    LevelIntermediate
    User Rating4.8 (100 globes from 21 users)
    CompatibilityVB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0
    CategoryEncryption
    WorldVisual Basic
    Archive FileCODE_UPLOAD8510822000.zip