I'm implementing a program that deflates a file into a git blob and stores it appropriately.
I have a ruby reference implementation that's based on an article from the git book
I'm attempting to implement this in go here
However, I'm running into an issue where the stored compressed data differs slightly with each implementation.
vbindiff
shows that the first 2 bytes are identical (as run from this test script) (If I'm reading this right). These bytes store the compression method and flags, and flags respectively (as per https://www.rfc-editor.org/rfc/rfc1950). The third byte is where the difference begins, this is either the dictionary ID or the start of the original input data. The data remains similar until near the end of the file. I'm assuming this is probably the difference in the ADLER32 checksum.
It seems that both the go and Ruby implementations of zlib do not pass a dictionary to zlib by default (as per go zlib source and ruby zlib source)
The data appears identical.
I'm not sure if there's an implementation error in the libraries or if I'm just missing something.
Why are these outputs different?