-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deterministic compression #223
Comments
It's irrelevant to this library. |
OK well, I found in practice that EasyCompressor output is non-deterministic. Can any of it be made deterministic? |
Actually, it is deterministic out of the box. |
Oh, I think I know what happened. I ran one test on Blazor WASM and another on Windows and got different results. Maybe it's something to do with which platform. |
I reproduced your example with different compressors and I found a there is a weird difference in GZip compressed output between server-side .NET and client-side (Blazor WASM). Brotli is not supported on Blazor WASM and the others (Deflate, LZ4, LZMA, Zstd, and Snappy) algorithms work fine (the same) between server and browser. GZip compressed output (and thereby its hash) is different between server and client. I should investigate more on it to find if it's a mistake implementation in this library or if it's a BUG for .NET runtime. The Repo: |
Yeah sorry I didn't realize I'd actually done the two tests on different runtimes when I made the initial post. Not a big deal: it just explains why my unit test failed. Thanks. :) |
You're welcome. |
It seems to also affect System.IO.Comprrssion on .NET Standard 2.0 as well so apparently it isn't specific to EasyCompressor. |
See this article here: https://dramsch.net/today-i-learned/gzip/today-i-learned-about-deterministic-gzip-compression/
I'd like to do the same thing but it appears EasyCompressor doesn't expose the necessary options to make GZip deterministic.
After looking into this a bit more, it appears that none of the EasyCompressor formats expose the necessary options to make them deterministic. We should be able to set the timestamp to 0 like in that article and get the exact same compressed output for the same decompressed input. If there's randomness, we should be able to control the seed.
The text was updated successfully, but these errors were encountered: