Re:“Should you encrypt or compress first?”
by IncRnd on Tuesday June 28, 2016 @02:23PM
(#11996178)
No. Salting is to keep stop pre-image attacks in encryption. It doesn’t affect compression.
[ Parent
| on HN ]
Re:“Should you encrypt or compress first?”
by crpatino on Tuesday June 28, 2016 @07:47PM
(#11998475)
And bottles are used for holding liquids rather than smashing heads... until you find yourself in a bar fight.
I might be wrong, but I think the parent had something like this in mind:
Assuming you are encrypting with AES-CFB your each plaintext block P[i] produces a ciphertext block C[i] (with key K and initialization vector IV) according to rule:
C[0] = AES_encrypt(K, IV) ^ P[0],
C[i] = AES_encrypt(K, C[i-1]) ^ P[i].
Given that IV is assumed to be known by the attacker, if the plaintext is a vanilla-compressed stream, it is more likely than not that most of bits in P[0] are going to be known as well, which might allow some sort of prunned brute-force attack on key K, given a small set of (C[0] ^ P'[0]), for all P'[0] that satisfy the known bits in P[0].This particular implementation would benefit then from adding a pseudorandom P[0] block (a "salt", if I understood correctly) that the receiver is to discard on arrival. I don't know enough cryptanalysis to tell if the above scenario is valid or not, but it sounds like a legitimate question at least.