Anyone willing to drop some learning on a lay person? Is encrypted data less compressable because it lacks the patterns compression relies on?
Or, is it less secure to encrypt first because smart people things? I know enough about cryptography to know I know fuck all about cryptography.
ELI5 : Take the string AAAA.
A simple Cypher would be to change the letters to the next one in the alphabet and offset by 1 for each letter, the message would encrypt to ABCD.
If you try to compress that, well you can’t do it, otherwise you lose required information.
If you were to compress AAAA first, you could represent it as the string 4A. You can then encrypt that to 5B.
Encrypting is about adding entropy to a message. Compressing is about finding common groups and represent them differently so that the size is lower. Compressing an encrypted message is basically useless because you added so much entropy to the message that there are no more recognizable patterns to apply compression to.
It’s not compressible at all. You will end-up with a file that is larger than the original.
Whether compressing before you encrypt leaks information, or not compressing is what leaks, or it’s irrelevant is complicated to decide and depends on the details of what you are doing. But encrypting and then compressing is a bit worse than useless, and always a mistake.
Also might be faster to encrypt a compressed file, since it will be smaller?
Well, encryption tends to be either a very fast operation or something with a slow stage that doesn’t depend on the size of your data. So although this is technically true, it’s also not relevant.
Encrypted data don’t compress well.
It’s less secure to compress and encrypt at all, unless the compresstext is static (such as a pre-made image or video). See BREACH.
Also a lay person. Maybe it’s because of the time complexity. Let’s say you have data of size 10 (any unit) which becomes size 8 after compression.
If you encrypt first: Encrypt size 10 of data -> Conpress size 10 of data
If you compress first: Compress size 10 of data -> Encrypt size 8 of data
So second way is faster as the compression still takes the same size of input but the encryption takes a smaller input.
Don’t know about gz but zip files can be encrypted using passwords
Doesn’t actually matter



