0

I am working with zlib data from 3 days and I can not get out of this problem:

The original zlib compressed data hex is as follows: 789c34c9410e82301005d0bbfc756b5a832ee62a94900146255620ed80314defae1b772f79050a5af6180df21feb06f2ce6002153c84930ec2dacf8b4a3a38821a7fbefcbed7c4a3805ab401775679f3c76e69b27bb6c259bd1d6cf3bc5d034c0978cd635a7300b993ab1dba5abf000000ffff

And the hex that I generate using the zlib python library is the following: 789c35c9410e82301005d0bbfc756b5a832ee62a94900146255620ed80314defae1b772f79050a5af6180df21feb06f2ce6002153c84930ec2dacf8b4a3a38821a7fbefcbed7c4a3805ab401775679f3c76e69b27bb6c259bd1d6cf3bc5d034c0978cd635a7300b993ab1dba5abfb1bd28150000ffff

Can anyone explain to me the difference between the two values?


import zlib, json
ZLIB_SUFFIX = b'\x00\x00\xff\xff'
data = json.dumps({
        "t": None,
        "s": None,
        "op": 10,
        "d": {
            "heartbeat_interval": 41250,
            "_trace": [
                '["gateway-prd-us-east1-b-4kf6",{"micros":0.0}]'
            ]
        }
    }, separators=(',', ':')).encode('utf-8')
deflate = zlib.compressobj(6, zlib.DEFLATED, zlib.MAX_WBITS)
result = deflate.compress(data) + deflate.flush() + ZLIB_SUFFIX
print(result)
Wasosky
  • 16
  • 1
  • Are you sure that the first string is a valid zlib-compressed something? I cannot decompress it neither with python nor with several tools I know... – STerliakov May 07 '23 at 22:24

0 Answers0