Question

I am working on a remote backup project in C... I want to send data and compress as well as encrypt the data.

However I am confused whether to compress first or encrypt first!

What will be better?:

  1. Compress the data and then encrypt it
  2. Encrypt the data and then compress it

Also I am going to use zlib for compression. And I am wondering which encryption lib to use... Some people say libgcrypt is good. Suggestion for good encryption libraries(very easy to use) will be appreciated... :)

or is there anything that does both of the jobs?

Thanks!

Was it helpful?

Solution

You should compress before encrypting.

Any good encryption algorithm will produce random-like data that will not compress well.

OTHER TIPS

My favorite easy to write, understand and use algorithm is blowfish. There are a few implementations at that link in a few liens of code.

It's roughly the same level of security as something like AES/DES, ie pretty much unbreakable. As with all crypto the real vulnerability is going to be you and your users!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top