1.6 KiB
Shitpress
Shitpress is a simple compression algorithm and utility made by drummyfish. It is written in C (a version in comun exists as well), the single header library is under 200 lines of code and doesn't use any library at all (not even stdlib). Shitpress was made more or less as an educational example when writing the article on compression for this wiki, but it turned out to be usable in practice. There is also supershitpress, a utility that uses the same algorithm repeatedly as long as the size gets reduced. Vanilla shitpress reduced the size of a raw website screenshot to 50% of the original size, text usually to around 80% of the original size -- that's nothing awesome, however shitpress works well on very simple data such as binaries and images that contain many repeating constant values and this is what it's meant for: a tiny, modest compression of simple data in very simple programs.
The algorithm works as a constant time and constant memory stream filter, so it's pretty fast and efficient. The principle is to basically treat the latest history (approx 64 bytes) as a dictionary so that if a sequence (of up to 6 bytes) that recently appeared occurs again, we just reference it with a 2 byte pointer (so the theoretical best compression ratio is 3).
As of writing this the repository is for example here.
{ Someone told me brieflz is probably something similar, you can check it out too. ~drummyfish }