Move ZLIB compression and decompression

Compression should be the last thing done before encoding for encryption and the
first thing done after decoding for decryption.