| 1 |
# Test vectors for MS-XCA [de-]compression |
| 2 |
|
| 3 |
There are currently two supported variants of the Xpress Compression |
| 4 |
Algorithm, "Plain LZ77" and "LZ77 + Huffman". For each we have two |
| 5 |
directories of files compressed on Windows, corresponding to the two |
| 6 |
compression levels that Windows offers. |
| 7 |
|
| 8 |
The subdirectories are |
| 9 |
|
| 10 |
./decompressed - test files to compress with .decomp extension. |
| 11 |
./compressed-huffman - LZ77+Huffman compressed, with .lzhuff extension. |
| 12 |
./compressed-more-huffman - LZ77+Huffman compressed, with .lzhuff extension. |
| 13 |
./compressed-plain - Plain LZ77 compressed, with .lzplain extension. |
| 14 |
./compressed-more-plain - Plain LZ77 compressed, with .lzplain extension. |
| 15 |
|
| 16 |
where the more-compressed-* versions have the files that Windows put |
| 17 |
more effort into compressing (largely in vain -- they are similar in |
| 18 |
size). Windows probably does not use this more effortful compression |
| 19 |
in network protocols, but these files must be decompressible. |
| 20 |
|
| 21 |
The compressed files were made using the Windows Compression API, |
| 22 |
which uses the same underlying code as MS-XCA, but which puts some |
| 23 |
annoying hurdles in the way. In particular, it won't perform |
| 24 |
LZ77+Huffman compression on any file smaller than 300 bytes. The |
| 25 |
relationship between the two is covered in various messages in |
| 26 |
|
| 27 |
https://lists.samba.org/archive/cifs-protocol/2022-October/ |
| 28 |
https://lists.samba.org/archive/cifs-protocol/2022-November/ |
| 29 |
|
| 30 |
To recreate these files or add more, use |
| 31 |
lib/compression/tests/scripts/generate-windows-test-vectors.c under |
| 32 |
Cygwin or MSYS2. This file is also in the decompressed directory. |
| 33 |
|
| 34 |
Some of the decompressed files were found via fuzzing, some are designed |
| 35 |
to test one aspect or another of the format, while others are public |
| 36 |
domain texts. |
| 37 |
|
| 38 |
These are used in compression and decompression tests. |
| 39 |
|
| 40 |
- For decompression tests, we need the decompressed versions to |
| 41 |
compare against. |
| 42 |
|
| 43 |
- For compression tests, we do not assert that the compressed file is |
| 44 |
identical to the Windows compressed file. Exact equality is not |
| 45 |
expected by MS-XCA, which leaves room for implementation tricks, but |
| 46 |
the size of the compressed file allows us to make ballpark |
| 47 |
assertions about expected compression ratios. |