Apparently current best practices recommend that you do not compress before you encrypt.
For example in this blog entry (*):
http://sockpuppet.org/blog/2013/07/22/applied-practical-cryptography/
It is written:
Developers shouldn’t compress plaintext before encrypting.
Or in this question here on crypto.se:
Is compressing data prior to encryption necessary to reduce plaintext redundancy?
several people answer that compressing before encryption is actually harmful.
What I really don't understand is that apparently the explanation is that the compression algorithms used leak information about the size of the plaintext input!?
But in which way does not using compression before encryption not leak info about the length of the input too?
What additional infos are leaked by compression algorithms that wouldn't be leaked by not doing compression?
If padding is used on plaintext encrypted without compression, couldn't paddding be used too before encrypting compressed data (or data to be compressed)?
Also: is it really a given that the attacks you make possible by using compression before encryption are more of a problem than the attacks made possible by not compressing before encrypting? (the latter being the reason for which, during more than two decades, it was always advised to compress before encryption).