Skip to content

Why zlib encoder encodes into different string from python's zlib #432

Answered by oyvindln
midstreeeam asked this question in Q&A
Discussion options

You must be logged in to vote

The default rust backend is originally a port of miniz which uses some slightly different parameters and algorithms for match searching and block splitting compared to the standard zlib library which results in slightly different results. (Why it was done that way in the original miniz librar I don't know, maybe for ease of implementation or something.) I believe the python function uses the standard c zlib library under the hood.

Worth noting that zlib-ng also produces slightly different results compared to normal zlib due to some speed tradeoffs (I believe they use a minimum match size of 4 instead 3 at least as noted here), and some linux distros, notably fedora have moved to swap out …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by midstreeeam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants