Is it better to encrypt a message and then compress it or the other way around? Which provides more security?

前端 未结 9 1281
离开以前
离开以前 2020-12-09 02:33

I have the assumption there is no added protection at all.

9条回答
  •  伪装坚强ぢ
    2020-12-09 03:04

    Encryption works better on short messages, with a uniform distribution of symbols. Compression replaces a message with a non-uniform distribution of symbols by another, shorter sequence of symbols that are more uniformly distributed.

    Therefore, it's mathemathically safer to compress before encryption. Compression after encryption doesn't affect the encryption, which remains relatively weak due to the non-uniform distribution of plaintext.

    Of course, if you use anything like AES256, and the NSA isn't after you, this is all theory.

提交回复
热议问题