I have a program that, in the course of doing its function, stores files at the bit level hidden in a windows bitmap.
The program reads the entire bitmap in memory and the entire file in memory then does its work then spits out the new bitmap.
The thing is i would like to be able to compress the file before inserting it, and uncompress it again later. It doesn't have to be a super compression routine. But for obvious reasons, it can't be a lossy one. I thought of the old "find a common string and replace with a marker" but i have no clue of how to search the file fast enough to accomplish this in a reasonable amount of time.

Does anyone have any source code in vb for a simple compression routine (preferred) or a not-so-simple one i can puzzle over?

For more obvious reasons, i'd like it to be a free compression routine.

Anyone got one?