When compressing and encrypting, should I compress first, or encrypt first?
问题 If I were to AES-encrypt a file, and then ZLIB-compress it, would the compression be less efficient than if I first compressed and then encrypted? In other words, should I compress first or encrypt first, or does it matter? 回答1: Compress first. Once you encrypt the file you will generate a stream of random data, which will be not be compressible. The compression process depends on finding compressible patterns in the data. 回答2: Compression before encryption is surely more space efficient but