xluffy / til

You only feel happy when you know what you doing
19 stars 1 forks source link

Nén trước rồi mã hóa hay mã hóa trước rồi nén? #240

Open xluffy opened 5 months ago

xluffy commented 5 months ago

Neither:

Specifically, compression allows an attacker who can control parts of the message that is encrypted to reveal things about the other, secret parts, like cookies in the case of web traffic. It is most dangerous in a live protocol like TLS. Some forms of compression (e.g. truly constant bitrate lossy video/audio compression) may be immune to such attacks (but even then there might be side channel attacks due to the compression).

In most cases you should just encrypt the uncompressed data and be done with it.

Data storage and transmission is usually cheap enough. If you cannot live without compression, you must do it first, but then you have to really know what you are doing and likely accept at least some loss of security.

tinnguyenwork commented 5 months ago

What if you want to encrypt a folder? Zip without compression and then encrypt the archive https://superuser.com/questions/411394/zip-files-without-compression

More TIL: https://www.passwordstore.org/ is a password manager using gpg under the hood