4

I encrypted a Word document using Winrar by setting a password. Surprisingly the archive was larger than the original file (631 vs 614KB). I then tested to see what would happen if encryption wasn't used and the result was a 612KB archive. Why is this?

Now that TrueCrypt is gone what's the best way to encrypt data to be saved to the cloud (e.g. google drive)?

9

Encrypting does not inherently make a file larger.

However, in practice, encrypted files are larger than their non-encrypted counterparts for a number of reasons:

  1. Symmetric ciphers in current use have the property that every possible ciphertext can be decrypted to a plaintext, or in other words, if somebody tampers with the encrypted file, it can still be decrypted. If you're encrypting a file, you usually want some assurance that the file hasn't been changed while you weren't looking, and this requires adding extra information in one form or another.

  2. Most symmetric ciphers work on blocks of data considerably larger than a single byte (AES-128, for example, works 16 bytes at a time). As a result, if the file isn't a multiple of the block size, you need to pad the end to fill a complete block. There are ways (such as "ciphertext stealing") to do this without making the encrypted file larger than the original file, but just adding a few bytes of padding is usually simpler.

  3. There are many different ways to encrypt a file. It's often useful to add a header to an encrypted file describing how it was done (what algorithm was used, what tamper-prevention mechanism is in use, how the password was expanded to produce a key, and so on). In theory, this reduces security by providing information to an attacker, but in practice, the increase in convenience outweighs any minor reduction.

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.