-2
$\begingroup$

Can I do encryption on a compressed file and again decompress the file after decryption to get the original data?

$\endgroup$
  • $\begingroup$ What are your thoughts? What makes you think you wouldn't be able to? Why are you unsure? $\endgroup$ – D.W. Jan 9 '16 at 22:08
3
$\begingroup$

Can i do encryption on a compressed file and again decompress the file after decryption to get the original data?

If the compression and decompression algorithms are lossless then yes.

If you are wondering about it, an example of a lossy compression system is the JPEG encoding process. The lost data is generally visually insignificant, but enables much better compression ratios. However strictly speaking an image encoded with JPEG will not produce exactly the same image after decompression.

Compression systems like zip, gzip and bzip use lossless compression.

Also note that compression is normally applied before encryption because encryption produces data that is essentially impossible to compress.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.