문제

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!

도움이 되었습니까?

해결책

You should compress before encrypting.

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

다른 팁

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!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top