问题
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?:
- Compress the data and then encrypt it
- 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!
回答1:
You should compress before encrypting.
Any good encryption algorithm will produce random-like data that will not compress well.
回答2:
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!
来源:https://stackoverflow.com/questions/13181309/compression-and-encryption-which-to-apply-first