bit-identical output to zstd command line tool
I am trying to generate bit idential binaries to the zstd command line tool.
specifically for the following invocation:
cat file | zstd -c -T0 --ultra -20 > file.zst
pipes matter, providing the output file as parameter changes the output.
i have tried:
let mut endcoder = zstd::Encoder::new(file, 20)
encoder.set_parameter(CParameter::NbWorkers(4))
the number of workers (and -T0) may be a red herring though since they do not seem to change output in my test.
calling the zstd binary using Command and utilizing two pipes does work but is a bit less comfortable than need be.
Hi, and thanks for the report!
I'm not entirely sure how to get bit-identical output with the CLI.
First, you will of course need to ensure you are using the exact same version of zstd (currently 1.5.5).
You will also need to enable the zstdmt feature for the multi-thread code to have any effect, and match the CLI. The number of workers shouldn't matter, as long as it's non-zero.
In addition, the zstd cli and the library have different default options. For example, the CLI includes checksum by default, but not the lib: you'll need to add CParameter::ChecksumFlag(true).