MATLAB: Should Compression(Huffman coding) be followed by Encryption(AES) or viceversa or both options are fine

compressionencryption

Should Compression(Huffman coding) be followed by Encryption(AES) or viceversa or both options are fine?
Please let me know the pros and cons of each approach.

Best Answer

The compression must be applied before the encryption. The AES encyption increases the entropy of the signal, such that a compression will not reducethe data size anymore.