Name | Modified | Size | Downloads / Week |
---|---|---|---|
README.txt | 2024-06-11 | 3.1 kB | |
litc-0.1.10.zip | 2024-06-11 | 335.6 kB | |
litc-0.1.2.zip | 2023-12-13 | 204.1 kB | |
litc-0.1.1.zip | 2023-09-05 | 91.5 kB | |
litc-0.1.0.zip | 2021-12-11 | 70.7 kB | |
litc-0.0.9.zip | 2021-11-29 | 110.1 kB | |
litc-0.0.8.zip | 2021-11-24 | 53.1 kB | |
Totals: 7 Items | 868.2 kB | 0 |
Litc - Light In-Band Text Compressor Litc allows the compression of small strings into byte arrays in a quick and easy way. The libLitc c# library provides the algorithm. You can use this code to convert UTF-8 strings into packed byte arrays. It's a dictionary based algorithm, with a static intial model that is dinamically updated. Quick Setup Add a reference to libLitc in your c# project. API public static byte[] GetBytes(string original) public static string GetString(byte[] compressed) The API simulate the ones used to pack/unpack UTF-8 strings. The following code uses the methods provided by the framework: string value = GetRandomText(); byte[] packed = Encoding.UTF8.GetBytes(value); string unpacked = Encoding.UTF8.GetString(packed); This code uses libLitc: string value = GetRandomText(); byte[] packed = Litc.GetBytes(value); string unpacked = Litc.GetString(packed); How It Works The Algorithm divides the possible values of a byte in three ranges: from 0 to 31 (control characters) from 32 to 126 (printable characters) from 127 to 255 (DEL and non ascii characters) The first action is to detect bytes that fall in the first range. If so, the string is not compressed, we prepend a NUL byte and encode it in UTF-8: the resulting byte array will be one byte longer. Take care, the first range holds: tabulation, new line, carriage return... Litc cannot compress strings that contain such characters. I wrote Litc in order achieve compression when archiving the paths present on the file system, where it's unlikely to meet this kind of symbols. If you really need to compress small strings that hold TAB, CR, LF now we offer the -a switch. This is the default for the new actions compress/decompress. If the third range is free and the string is longer than 62 bytes, we prepend a SOH byte in order to instruct both the encoder and the decoder to use more entries in our dictionary. Authors Software created and coded by Alberto Innocenti License GNU Lesser General Public License Changelog 2024-06-11(0.1.10) bugfix release, use this version the decoder had a bug when the file was not compressable. The encoded file is still good, with this version it can be decoded. 2024-06-07(0.1.9) no code changes, in one tree we have the dotnet-8.0 and the framework-4.8 the previous release needed framework-4.0 2024-06-03(0.1.8) stress tested against 0.1.2, checked that is retro compatible 2024-05-31(0.1.7) improved exit codes, the -a flag 2024-05-30(0.1.4) created the libLitcTab.dll for compressing strings with TAB, CR, LF. Improved the command line in order to compress/decompress whole files. 2023-09-05(0.1.1) minor code refactor 2021-12-11(0.1.0) reviewed unit test, added the icon artwork, in-depth tests, it looks ready to go beta. 2021-11-29(0.0.9) improved the tester program, added the artwork, improved the README file 2021-11-24(0.0.8) first deployable version