7
2
The discussion of "compress and then encrypt, or vice-versa" led me to ponder the following question: many compression containers, like ZIP
, 7z
, and rar
support encrypting these containers. For example, when creating a 7z
file in 7-Zip, the program lets you enter an encryption password.
For these file types, are the files compressed and then encrypted, as recommended in the aforementioned question, or the reverse? Or, is there some way that these can compress and encrypt the data at the same time?
When I create an encrypted 7z file, I can view the filenames inside of the encrypted archive, but I cannot view the contents of those files without entering the passphrase. How is this possible? As an aside, is there any way to encrypt a 7z or similar archive such that the file names and directory structure within are not visible without using the passphrase?
I would prefer answers with definitive sources/references, not just speculation. We can all make guesses about this, but if somebody can show me documentation proving that it works one way or another, that would be ideal.
1from what i remember of a OS concepts video, nothing in the system is being processed 'at the same time' i think the whole entity, string, data structure would need to be complete before applying a hash function. like a hash applied to 123456789 would be vastly different from the same hash applied to 123 then 456 then 789 and then concatenated. and i would think the reason you can view filenames unencrypted would just be that they are pointing to the encrypted part but are not encrypted themselves. perhaps 7zip makes a new address for the name separate from the rest of the file. – fightermagethief – 2011-03-22T04:36:40.243
The answers to the linked question pretty much conclude that compressing, then encrypting, is the only way to go. – user1686 – 2011-03-22T05:52:39.110