I'm working on a pure-Perl OpenPGP implementation (will be on CPAN in the next couple of days, Crypt::OpenPGP; the link will work when it's up :). And so on this particular day today I am working on the compression code, using Compress::Zlib.
It turns out that the reason I was having the problem is because I am very, very stupid.
For the compression code I am using the relatively low-level Compress::Zlib interface (deflateInit, etc.) and after deflating, I am calling flush. And I was giving flush the Z_PARTIAL_FLUSH parameter, and then I tried Z_SYNC_FLUSH, etc. etc. The reason I did this is because when I was writing the compression code for Net::SSH::Perl, it took me a while to realize that I needed to use Z_PARTIAL_FLUSH. So I figured, why not save myself some time and just start using the "correct" flush type in the beginning.
This is a problem when the "correct" flush type is not so correct.
So I spent hours debugging the code, printing out hex dumps of the compressed and decompressed data, etc.
All the time not realizing that *the default*, Z_FINISH (which you get if you don't supply any args at all--hence default), is what works for PGP.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: My Stupid Head, or why you should never stop thinking
by jepri (Parson) on Jul 27, 2001 at 11:56 UTC |