| 1 | # PPMd in native Rust |
| 2 | |
| 3 | [](https://crates.io/crates/ppmd-rust) |
| 4 | [](https://docs.rs/ppmd-rust) |
| 5 | |
| 6 | PPMd compression / decompression. It's a port of the PPMd C-code from 7-Zip to Rust. |
| 7 | |
| 8 | The following variants are provided: |
| 9 | |
| 10 | - The PPMd7 (PPMdH) as used by the 7z archive format |
| 11 | - The PPMd8 (PPMdI rev.1) as used by the zip archive format |
| 12 | |
| 13 | ## Notice |
| 14 | |
| 15 | There are two ways to properly bound the uncompressed data: |
| 16 | |
| 17 | 1. Save the uncompressed size along the compressed data and use `std::io::Read::read_exact()` to read the data |
| 18 | (this is what is used in the 7z archive format). |
| 19 | 2. Encode an end marker by calling `finish(true)` on the encoder when finishing the encoder process. You can then use |
| 20 | `std::io::Read::read_to_end()` to read the data. You are of course free to also use the `std::io::Read::read_exact()` |
| 21 | if you have stored the uncompressed data size (this is what is used in the zip archive format). |
| 22 | |
| 23 | Failing to do so will result in garbage symbols at the end of the actual data. |
| 24 | |
| 25 | ## Acknowledgement |
| 26 | |
| 27 | This port is based on the 7zip version of PPMd by Igor Pavlov, which in turn was based on the PPMd var.H (2001) / |
| 28 | PPMd var.I (2002) code by Dmitry Shkarin. The carryless range coder of PPMd8 was originally written by |
| 29 | Dmitry Subbotin (1999). |
| 30 | |
| 31 | ## License |
| 32 | |
| 33 | The code in this crate is in the public domain as the original code by their authors. |