Can I compress an encrypted file? (2024)

10 Answers

18

You can compress it, but it is unlikely to save much disk space. By its nature, encryption rarely leaves a file compressible by much.

Try it for yourself to see if there is any file size savings.

One data point:

-rw-r----- 1 gene gene 2428671 2009-06-02 12:39 test.log-rw-r----- 1 gene gene 134524 2009-06-02 12:39 test.log.bz2-rw-r----- 1 gene gene 217162 2009-06-02 12:38 test.log.gz-rw-r--r-- 1 gene gene 263229 2009-06-02 12:47 test-AES.gpg-rw-r--r-- 1 gene gene 264833 2009-06-02 12:42 test-AES.gpg.bz2-rw-r--r-- 1 gene gene 263302 2009-06-02 12:41 test-AES.gpg.gz-rw-r--r-- 1 gene gene 134609 2009-06-02 12:43 test-bz2-AES.gpg-rw-r--r-- 1 gene gene 217246 2009-06-02 12:43 test-gz-AES.gpg

test.log is the original, and test.log.bz2 and test.log.gz are simply compressed with bzip2 and gzip, respectively.

If I encrypt it (gpg --symmetric --cipher-algo AES --output test-AES.gpg test.log) the encrypted file (test-AES.gpg) is slightly larger than compressed versions. Compressing the encrypted file actually adds a little size (test-AES.gpg.bz2 and test-AES.gpg.gz).

Compressing first then encrypting does show some savings (test-bz2-AES.gpg and test-gz-AES.gpg), especially with bzip2.

Of course, your experience may differ given different encryption software and/or different compression software.

You should consider whether the file size savings you get simply via encryption is enough, or if compressing then encrypting is worth the extra step in the process.

answered Jun 2, 2009 at 16:08

Can I compress an encrypted file? (1)

Gene GotimerGene Gotimer

2,4622020 silver badges1616 bronze badges

3

  • Really? never thought of that before

    Jun 2, 2009 at 16:09

  • 1

    Of course, if you encrypted the file yourself and know how it can be decrypted, decrypting it and storing it compressed together with a program to encrypt it again will save much more space.

    Jun 2, 2009 at 16:22

  • 1

    "Of course, your experience may differ given different encryption software and/or different compression software." Actually, no. Any encryption worth the name will produce ciphertext that is practically incompressible (see other answers for the reasons).

    sleske

    May 10, 2010 at 0:38

Add a comment |

11

Not if the encryption is any good. Compression deals with recognizing patterns in data and creating a "shorthand" that refers to those patterns for later extraction.

If your encryption is good, the file looks like random noise, and that's not going to compress very much due to the absence of patterns. Of course you can put it in to an archive file (.zip, .gz, etc.), but you aren't likely to make it get much smaller.

Add a comment |

8

Compression programs don't modify the actual data in any way - if they did, they would be useless. (Sound and image compression is an exception, as the human's eye doesn't see such small changes, while a computer can choke on a single flipped bit.) So yes, you can compress encrypted files.

But since encrypted data is very similar to random data, it doesn't compress very well - so if you can, compress before encrypting. Otherwise the "compression" will be fairly useless.

For a compression program, Unix world prefers tar along with gzip/bzip2 (usually used from within tar, as in tar czf foo.tar.gz foo), while Windows users prefer ZIP, RAR or 7z.

answered Jun 2, 2009 at 16:11

Can I compress an encrypted file? (3)

user1686user1686

9,3262525 silver badges3838 bronze badges

3

  • 1

    compression before encryption can significantly weaken the encryption. It's best to use a tool designed to do both in order to avoid the common pitfalls

    Aug 17, 2009 at 16:05

  • Or it can strenghten it - known plaintext attacks are much harder.

    Aug 18, 2009 at 19:17

  • 1

    @EK: I've never heard of this. Any serious encryption algorithm should be secure for any source data, no matter its nature. Do you have any references for your claim?

    sleske

    May 10, 2010 at 0:33

Add a comment |

4

Using any compression program (7z, zip, gzip, bzip2) is lossless and does not affect your ability to decrypt the data.

However, due to the nature of the encrypted data, you will probably not gain much from it.

The proper thing to do is compress it before the encryption step. Existing utilities such as gpg do this. The behaviour to compress before encryption is the default:

michael:~> dd if=/dev/zero of=testfile bs=1048576 count=11+0 records in1+0 records out1048576 bytes (1.0 MB) copied, 0.00300552 s, 349 MB/smichael:~> gpg --symmetric --cipher-algo aes --batch --passphrase cheesestring testfilemichael:~> ls -al testfile testfile.gpg-rw-r--r-- 1 michael users 1048576 2009-06-02 12:42 testfile-rw-r--r-- 1 michael users 1123 2009-06-02 12:43 testfile.gpg

answered Jun 2, 2009 at 16:46

Can I compress an encrypted file? (4)

MikeyBMikeyB

39k1010 gold badges103103 silver badges189189 bronze badges

Add a comment |

3

An encrypted file will lose the statistical properties that make compression work, so compressing the encrypted file will save little if any space. You should compress the file first (while it still behaves in a way that compresses well) before encrypting the compressed file. Aside from that, the compression will not affect the original content of the file when you come to uncompress it.

answered Jun 2, 2009 at 16:39

Can I compress an encrypted file? (5)

ConcernedOfTunbridgeWellsConcernedOfTunbridgeWells

8,82022 gold badges3131 silver badges5252 bronze badges

Add a comment |

2

A file that can be compressed after encryption was by definition not encrypted. Perhaps it was "scrambled" or "obfuscated". Encrypted data is indistinguishable from random data.

Encryption software that does not first compress a file before doing the encryption is committing an act of negligence.

You can run an encrypted file through a lossless compression algorithm without destroying the data. This is the guarantee of compression - that whatever data you give it as input will be recovered as output from decompression. By definition, a lossless compression algorithm will return any data to you if you compress and uncompress.

answered Jun 2, 2009 at 17:00

Can I compress an encrypted file? (6)

carlitocarlito

2,4991818 silver badges1212 bronze badges

Add a comment |

2

Usually in these situations you compress first, then encrypt, as you get better compression ratios that way.

answered Jun 3, 2009 at 0:53

Can I compress an encrypted file? (7)

EvanEvan

34911 gold badge33 silver badges66 bronze badges

Add a comment |

Yes, it should not cause any issues. As far as the encryption program is concerned, its just data. However, it would be hard to recover the data, so you might want to use PAR2 after you create the archive.

answered Jun 2, 2009 at 16:07

Can I compress an encrypted file? (8)

Kyle BrandtKyle Brandt

83.1k7171 gold badges302302 silver badges444444 bronze badges

Add a comment |

I think on balance the amount of space you would save would not be worth the potential problems it would cause.

Of course this will depend on what operating system you are using, whether your files are local or on a network, what sort of backup your doing, what your using for encryption and what kind of files your working with.

The main problem would be access speed, in that you will have to first uncompress then decrypt and whether the files are large or small its going to add processes. Also you will becompounding the risk of failure by adding processes.

Finally remember that your decryption software will want to decrypt an uncompressed file so you could end up with a compressed and uncompressded version existing at the same time, which would take twice the disk space at that moment.

answered Jun 2, 2009 at 16:51

davidcoxondavidcoxon

Add a comment |

-3

For the people that say you should compress before encryption, the reason why that is less secure is because of "known plaintext attacks". If someone knows that you compressed your data with gzip before encrypting, that means that they know the first handful of bytes of your plaintext already, since it will be the gzip header. From here they have a bit more of a foothold for cracking your encrypted data.

As always, there is no such thing as perfect security, and encrypting first may be perfectly fine for most uses but just FYI, it does make it less secure compressing before encrypting.

For folks who like this sort of stuff, I'm working on a few articles that talk about the basics of cryptography (aimed at programmers and other technical folk):

http://blog.demofox.org/category/cryptography/

answered Sep 15, 2012 at 18:02

Can I compress an encrypted file? (9)

Alan WolfeAlan Wolfe

1

1

  • 1

    Good crypto is resilient against known plaintext attack. If you're using AES with any sane block chaining method you're safe.

    Sep 16, 2012 at 13:58

Add a comment |

Not the answer you're looking for? Browse other questions tagged

or ask your own question.

Can I compress an encrypted file? (2024)

FAQs

Can I compress an encrypted file? ›

Some tape devices make use of their own compression when you store data. By definition, data that is encrypted should not be compressible; if you can compress encrypted data it is probably not well encrypted. You might want to compress your data before you encrypt it using the COMPRESSION option of Encryption Services.

What happens when you compress an encrypted file? ›

Compression reduces the amount of space and bandwidth needed to store and transmit data, which can improve efficiency, speed, and cost. Encryption transforms data into an unreadable form that can only be decrypted with a key, which can prevent unauthorized access, tampering, and leakage.

Why cant you compress an encrypted file? ›

rar or . 7z archives) only works well when there is non-random data that it can simplify. Good encryption on the other hand intentionally tries to make the data appear random, so compressing encrypted data doesn't really make sense. Save this answer.

Does encryption affect compression? ›

Initially, it was thought that the only way to combine encryption and compression was to compress the data before encryption. This is due to the fact that compression relies on patterns in data to function, while encryption attempts to destroy these patterns in data.

How do I compress a secure file? ›

1. Right-Click on the file or folder you wish to encrypt. Click Send To, Compressed (zipped) Folder. If you don't want to protect your files with passwords, then congratulations!

Can I compress an encrypted PDF file? ›

It's possible to compress an encrypted or locked PDF even if you don't know the password, however compressing a PDF will not bypass security settings, such as passwords. So you'd still need to unlock the PDF normally before being able to open or edit it.

Should you encrypt or compress first? ›

Compress first. Once you encrypt the file you will generate a stream of seemingly random data, which will be not be compressible. The compression process depends on finding compressible patterns in the data.

How do I reduce the size of an encrypted PDF? ›

Go to the Tools tab > select Optimize PDF > click Open to access the PDF file you want to compress > select Reduce File Size > click OK. Alternatively, you can use Adobe Online PDF Compressor. It's a free tool that offers three compression options: High Compression (smallest size, lower quality)

What are the disadvantages of encrypted files? ›

Encryption Disadvantages:

The user would be unable to explore the encrypted file if the password or key got the loss. However, using simpler keys in data encryption makes the data insecure, and randomly, anyone can access it.

Should you encrypt a file before compressing? ›

You should compress before encrypting. Encryption turns your data into high-entropy data, usually indistinguishable from a random stream. Compression relies on patterns in order to gain any size reduction.

Is compressing the same as encrypting? ›

Encrypt means to convert (information or data) into a cipher or code, especially to prevent unauthorized access. Compression is a reduction in the number of bits needed to represent data.

Does compressing a file make it more secure? ›

Enhanced Data Security

Utilizing file compression is a huge gain in terms of data security. The encryption element permits secure file sharing and e-mailing. It is excellent for hiding information, and high-end compression software isn't reversible by commonly used computer software.

How do I compress an encrypted PDF online? ›

How to compress a PDF
  1. Click the Select a file button above, or drag and drop files into the drop zone.
  2. Select the PDF file you want to make smaller.
  3. After uploading, Acrobat will automatically reduce the PDF size.
  4. Download your compressed PDF file or sign in to share it.

How do I compress and Encrypt files in Windows 10? ›

Right-click (or press and hold) a file or folder and select Properties. Select the Advanced button and select the Encrypt contents to secure data check box. Select OK to close the Advanced Attributes window, select Apply, and then select OK.

How do I zip a file and password protect it? ›

Zipped folder
  1. In Windows Explorer, highlight and right-click on the files you would like to put into a zipped file.
  2. Select Send to, then Zip folder (compressed). ...
  3. Double-click the zipped file, then select File and Add Password.
  4. Fill out the requested information, then click Apply.

How to save an encrypted PDF as unencrypted without password? ›

Fix 1. Unlock Encrypted PDF Without Password via Adobe Acrobat
  1. Open the encrypted or locked PDF file in Adobe Acrobat.
  2. Click "File" and open Properties.
  3. Now, click on "Permission Details" and open the Security tab. ...
  4. Click on the "Remove Password in Security Method" menu. ...
  5. Save the PDF file and now access the file.
Mar 7, 2023

What does it mean when a PDF file is encrypted? ›

Encryption simply means a file requires an encryption key (like a password) to decrypt it. If you send the encrypted file to another entity, a password will be required to open and view the file.

What happens when you encrypt a PDF file? ›

Encrypting a PDF document protects its content from unauthorized access. Confidential PDF documents can be encrypted and protected with a password. Only people who know the password will be able to decrypt, open and view those documents.

What is the most secure encryption format? ›

Although extremely efficient in the 128-bit form, AES also uses 192- and 256-bit keys for very demanding encryption purposes. AES is widely considered invulnerable to all attacks except for brute force.

What format is best to compress? ›

What is the overall best compression format? It depends on user's need, with compression ratio being only one factor of the equation. ZPAQ and ARC are the best compressors, but 7Z and RAR formats has a clear advantage in terms of decompression speed, faster than for any other tested format.

Should you encrypt and zip or zip and encrypt? ›

It is more efficient to encrypt files while they are being added to the Zip file than to encrypt them after they have been added.

Can we convert a encrypted PDF to normal PDF? ›

How do I convert encrypted files to normal PDFs? With UPDF, you can tap on the "Protect Using Password" icon on the right after uploading a PDF file to UPDF. Then you need to select the "Remove Security" option and click the "Remove" button on the pop-up window. Finally, save the changed file.

How do I compress a large PDF without losing quality? ›

How do I reduce the size of a PDF without losing quality?
  1. Click in the file selection box at the top of the page and select the files to compress.
  2. Change the compression mode to lossless compression and start compression with the corresponding button.
  3. Finally, save the compressed files.

How strong is PDF encryption? ›

When you password protect a PDF file using Adobe, it is encrypted with 256-bit AES encryption in Cipher Block Chaining Encryption (CBC) mode. Cryptographically, this is fine, but it's worth remembering that encrypting a PDF only encrypts the contents of the file.

What is the best PDF encryption remover? ›

Comparative Analysis of the 10 Best PDF Password Remover
ToolOperating SystemUsability
PDF Password GeniusWindowsComplex
SmallpdfWindows, Mac, Android, iOS, OnlineEasy
iLovePDFWindows, Mac, Android, iOS, OnlineEasy
PDF2GoWindows, OnlineMedium
6 more rows
Feb 23, 2023

How do I compress a PDF below 1 MB? ›

Compress PDFs offline to 1MB for free.
  1. Open the file in a PDF editor like Adobe Acrobat.
  2. Open the Tools center and click the Optimize PDF tool.
  3. Choose a file to compress.
  4. Select Reduce File Size in the top menu.
  5. Pick the file version compatibility.
  6. Rename and save your file.

How do I send an encrypted PDF? ›

How to secure a PDF.
  1. Launch Adobe Acrobat and select the Protect tool from the Tools menu.
  2. Choose your protection settings. ...
  3. Once you've protected your file, save it as a separate copy for safekeeping.
  4. Select Share With Others from the top toolbar.
  5. Add the recipients' email addresses. ...
  6. Select Send to share your file.

What happens if an encrypted file is moved to another drive? ›

If a file is moved from encrypted folder to another encrypted folder it will remain encrypted too. The best solution will be to decrypt the volumes, move your files etc and then encrypt it again and share it again since moving the files will have broken the share link to it.

What is the problem with encryption? ›

Encryption gives you a false sense of security

Reports from the press indicate that the hackers appeared to have gained entry using information stolen in a separate, even more audacious attack on one of the world's highest profile security firms: RSA.

What happens when you move or copy an encrypted file to a folder that is not encrypted? ›

The individual files themselves are not automatically decrypted. However, if a user has the permission to decrypt a file, and that user copies or moves an encrypted file to a file allocation table (FAT) or FAT32 partition, the destination file will be unencrypted.

Why is it recommended to encrypt folders instead of files? ›

Trust us, it's safer this way. Encrypting files, folders, and drives on your computer means that no one else can make sense of the data they contain without a particular decryption key—which in most cases is a password known only to you.

Does compressing a file make it a zip? ›

A zip file is a file format that can contain multiple files combined and compressed into one file. Files that are zipped have a file extension of . zip. Since it's a type of compressed file, a zip file can be smaller in size than the files it contains.

What is the major disadvantage of using file compression? ›

A compressed file also requires less time for transfer while consuming less network bandwidth. This can also help with costs, and also increases productivity. The main disadvantage of data compression is the increased use of computing resources to apply compression to the relevant data.

Do files lose quality when compressed? ›

For example, when a picture's file size is compressed, its quality remains the same. The file can be decompressed to its original quality without any loss of data. This compression method is also known as reversible compression.

Is emailing a zip file secure? ›

Email on its own does not protect your information whatsoever. While your information is being transferred, there is a potential for it to be intercepted by unauthorized parties. Encrypting zip files is really simple if you're using third-party software like TitanFile or WinRar.

How to compress 200 MB to 20mb? ›

The easiest way to compress 200 mb XLSX to 20 mb winrar
  1. Upload a document from your computer or cloud storage.
  2. Add text, images, drawings, shapes, and more.
  3. Sign your document online in a few clicks.
  4. Send, export, fax, download, or print out your document.

How do I encrypt a file before emailing? ›

In message that you are composing, click File > Properties. Click Security Settings, and then select the Encrypt message contents and attachments check box. Compose your message, and then click Send.

Is it better to encrypt first and then compress it or the other way around in case of a MS Powerpoint document? ›

Compress and then encrypt is better. Data compression removes redundant character strings in a file. So the compressed file has a more uniform distribution of characters. This also provides shorter plaintext and ciphertext, which reduces the time spent encrypting, decrypting and transmiting the file.

Does Windows 10 support encrypted Zip files? ›

Windows 10 provides an encryption feature as well, and you can follow these simple steps to use it: Right-click a file or a folder, and click “Properties”. Click “Advanced” and tick the “Encrypt contents to secure data” box. Click “o*k”, “Apply”, and then “o*k”.

Does password protecting a zip file encrypt it? ›

There are two levels of security on a password-protected Zip file: the encryption security and the password. There are currently two standard levels of encryption for Zip files, 128 and 256 bits, with 256-bit encryption far superior to the 128-bit version.

How do I password protect a zipped folder in Microsoft 10? ›

How do I password protect a zipped folder in Microsoft 10
  1. Right-click (or press and hold) a file or folder and select Properties.
  2. Select the Advanced button and select the Encrypt contents to secure data check box.
  3. Select OK to close the Advanced Attributes window, select Apply, and then select OK.
Mar 29, 2018

Which zip command will provide the best password protect and encrypt on a zipped file? ›

To password protect a file simply run the zip command and supply the -e flag (which is short for --encrypt ).

Do you lose file information when compressing? ›

Compression reduces the size of a file, often without appreciable loss of information. It can be either lossless or lossy. A smaller-sized compressed file can be restored to its larger form -- in its entirety or with some data loss, depending on the compression type -- by decompression.

Is a compressed file more secure? ›

Unfortunately, this simple compression technology lacks basic security. As such, there is a risk of compromise or misuse even when sharing files between known parties. One way to strengthen security of Zip files is by password-protecting them, in the same way you can password-protect PDF files or other documents.

Which is better encrypt and zip or zip and encrypt? ›

9 Answers. There is no difference in the security provided, but because of the way compression algorithms work, you are probably going to get better compression if you compress first then encrypt.

Why does compressing a file not make it smaller? ›

Compressing a file is computationally intense, so the more you try to compress a file, the longer it takes to compress. Users have to choose between how much they want a file to compress and how long it will take to do the compression.

When should a file be compressed? ›

Compressing is mainly used for the following purposes:
  1. A compressed file takes up less storage space. ...
  2. Several files and folders are combined into one package that is easy to manage; it is usually easier to handle one file than a set of, say, 10,000 files.

What are the two types of file compression? ›

What are the two types of data compression? There are two methods of compression – lossy and lossless. Lossy reduces file size by permanently removing some of the original data. Lossless reduces file size by removing unnecessary metadata.

What is the strongest file encryption? ›

The best encryption for files depends on the specific use case and requirements. AES-256 is considered one of the most secure and commonly used encryption algorithms. Although for most practical purposes, AES-128 will do just as well.

Does encryption preserve size? ›

Conclusion. Deterministic encryption as with FPE and (ECB/CBC)-CS enables you keep the same ciphertext size as plaintext size, where FPE additionally enables you to keep the same character set.

How do I compress and encrypt files in Windows 10? ›

Right-click (or press and hold) a file or folder and select Properties. Select the Advanced button and select the Encrypt contents to secure data check box. Select OK to close the Advanced Attributes window, select Apply, and then select OK.

What file types Cannot be compressed? ›

Text, uncompressed documents, spreadsheets, and databases (doc, xls...), uncompressed images (bmp, tiff), audio and video - especially if computer generated or containing low noise from the analogic source.

Can files get corrupted when compressed? ›

While ZIP files are convenient to use, they can get corrupted in transfer. It's not uncommon for the sender of a ZIP file to get a message from the receiver that they can't open the files, even though the sender themselves have no problem unzipping the folder and accessing the files.

What is the best file type to compress? ›

At maximum compression level, ZIPX is the fastest format, followed by RAR, ARC, and 7Z, ZPAQ being the slowest. Using moderate compression settings, RAR and ARC emerge as the fastest formats.

Top Articles
Aquarius Yearly Horoscope 2024: Check what the stars say about you this year
What is ZCash and How does it work?
Whas Golf Card
Metallica - Blackened Lyrics Meaning
Live Basketball Scores Flashscore
Faint Citrine Lost Ark
Craigslist Cars And Trucks For Sale By Owner Indianapolis
Southside Grill Schuylkill Haven Pa
Senior Tax Analyst Vs Master Tax Advisor
From Algeria to Uzbekistan-These Are the Top Baby Names Around the World
Dr Doe's Chemistry Quiz Answer Key
Lowes 385
Tabler Oklahoma
Garrick Joker'' Hastings Sentenced
Declan Mining Co Coupon
William Spencer Funeral Home Portland Indiana
Hallelu-JaH - Psalm 119 - inleiding
Rosemary Beach, Panama City Beach, FL Real Estate & Homes for Sale | realtor.com®
The Murdoch succession drama kicks off this week. Here's everything you need to know
All Buttons In Blox Fruits
Nj State Police Private Detective Unit
Enterprise Car Sales Jacksonville Used Cars
Simplify: r^4+r^3-7r^2-r+6=0 Tiger Algebra Solver
Spergo Net Worth 2022
Gemita Alvarez Desnuda
How do I get into solitude sewers Restoring Order? - Gamers Wiki
Watch The Lovely Bones Online Free 123Movies
Effingham Bookings Florence Sc
Bing Chilling Words Romanized
Ratchet & Clank Future: Tools of Destruction
Is The Yankees Game Postponed Tonight
Program Logistics and Property Manager - Baghdad, Iraq
Shiftselect Carolinas
Like Some Annoyed Drivers Wsj Crossword
The 15 Best Sites to Watch Movies for Free (Legally!)
Ipcam Telegram Group
Helpers Needed At Once Bug Fables
Bridgestone Tire Dealer Near Me
Sinai Sdn 2023
How To Make Infinity On Calculator
Nextdoor Myvidster
Compress PDF - quick, online, free
Domino's Delivery Pizza
Craigslist Pets Huntsville Alabama
San Bernardino Pick A Part Inventory
Lake Kingdom Moon 31
Best Haircut Shop Near Me
3500 Orchard Place
Adams-Buggs Funeral Services Obituaries
Here’s What Goes on at a Gentlemen’s Club – Crafternoon Cabaret Club
Elizabethtown Mesothelioma Legal Question
Latest Posts
Article information

Author: Moshe Kshlerin

Last Updated:

Views: 5698

Rating: 4.7 / 5 (77 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Moshe Kshlerin

Birthday: 1994-01-25

Address: Suite 609 315 Lupita Unions, Ronnieburgh, MI 62697

Phone: +2424755286529

Job: District Education Designer

Hobby: Yoga, Gunsmithing, Singing, 3D printing, Nordic skating, Soapmaking, Juggling

Introduction: My name is Moshe Kshlerin, I am a gleaming, attractive, outstanding, pleasant, delightful, outstanding, famous person who loves writing and wants to share my knowledge and understanding with you.