Kroning has asked for the wisdom of the Perl Monks concerning the following question:


I have some packet from app that looks like "ec bd ... 00 00 ff ff" which I am trying to decode.

From what I have found, it looks like "00 00 ff ff" is a Z_SYNC_FLUSH of deflate (zlib).

I tried to reproduce it on Compress::Raw::Zlib, Compress::Zlib and some others. But the ending pattern was "00 ff 00 ff". Am I missing something?

#!/usr/local/bin/perl use Compress::Zlib ; my $x = deflateInit() or die "Cannot create a deflation stream\n" ; ($output, $status) = $x->deflate('text') ; ($output, $status) = $x->flush(Z_SYNC_FLUSH) ; $output =~ s/(.)/sprintf '%04x', ord $1/seg; print "output=$output\n";