Is it better to encrypt a message and then compres

2019-01-17 15:46发布

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

8条回答
2楼-- · 2019-01-17 16:16

Warning: if an attacker controls part of the plaintext that gets compressed, and can observe the size of the resulting encrypted ciphertext, they may be able to deduce the rest of the plaintext, by adjusting the part that they control until the length of the ciphertext decreases (which implies that there was some repetition between the part of the plaintext they control and the secret part of the plaintext).

See https://en.wikipedia.org/wiki/CRIME for example.

查看更多
The star\"
3楼-- · 2019-01-17 16:19

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.

查看更多
登录 后发表回答