Posted 13 February 2017 - 06:32 PM
LZW is a sorta not really kinda compression algorithm thingy created by Abraham Lempel, Jacob Ziv, and Terry Welch hence the name, Lempel Ziv Welch. It is used in the *nix program compress, and GIF images.
I have ported somebody's implementation of it in Lua, you can find the original here.
It isn't really that bad, but it has it's quirks. (Shaves 1 character off of "This is a test.", your mileage may vary.)
It is also fast, less than a second for "This is a test."
Load up the API
and use lzw.Encode(text) and lzw.Decode(text) to inflate and deflate.
You can download it with: pastebin get WZKTR9q4 lzw
Yeah, I know about the typos. I originally thought it was LWZ.
Also, sorry about the sad mush of a post I made. Couldn't upload much because were dealing with a storm at the moment
The API is licensed under MIT because of the original file.
You can find a layman term page for MIT here.
I have ported somebody's implementation of it in Lua, you can find the original here.
It isn't really that bad, but it has it's quirks. (Shaves 1 character off of "This is a test.", your mileage may vary.)
It is also fast, less than a second for "This is a test."
Usage
Because the original implementation was really simple, this inherits that.Load up the API
os.loadAPI("/lzw")
,and use lzw.Encode(text) and lzw.Decode(text) to inflate and deflate.
You can download it with: pastebin get WZKTR9q4 lzw
Yeah, I know about the typos. I originally thought it was LWZ.
Also, sorry about the sad mush of a post I made. Couldn't upload much because were dealing with a storm at the moment
The API is licensed under MIT because of the original file.
You can find a layman term page for MIT here.
Edited on 25 February 2017 - 10:55 AM