Hacker News new | ask | show | jobs
by xncl 2046 days ago
That's why it's compressed before encryption?
1 comments

Yeah, because encrypted data should be incompressible, as it should be indistinguishable from random data, which is also incompressible.

Reality is a little different of course, and compression can cause problems for encryption because compressed data tends to be highly predictable (especially things like compression headers and compression dictionaries). This allows for potential “known/chosen plaintext” attacks on the encryption.

Some classic examples of this type of attack are breaking Enigma (known plaintext, no compression) by assuming the content of some messages[0] and the more recent CRIME[1] attacks against TLS using compression to help produce a chosen plaintext.

The simple solution in these scenarios is to avoid using compression completely.

[0] https://www.quora.com/Did-the-inclusion-of-Heil-Hitler-at-th... [1] https://en.m.wikipedia.org/wiki/CRIME