Reputation: 405
I need a fast and strong compression + encryption method for my DAT
file.
I've a DAT
file which contains very sensitive information and I would like to compress and encrypt it. I know I can use Zlib in compression method but how about the encryption method too ?
many thanks
Upvotes: 1
Views: 4242
Reputation: 43023
If you need both encryption and compression at the same time, you have two ways of implementing it:
In all cases, the best is to compress before encryption. It is more difficult to uncypher data from a compressed format, since its content is less expectable.
Then rely on a strong enough encryption algorithm (like AES).
You have all those features in our Open Source units (from Delphi 5 up to XE2). You can use ZIP, or try our much faster (but less efficient in term of compression ration) SynLZ. Then SynCrypto can be used to encrypt it. There are direct functions handling RawByteString
kind of data, which contents the data in a memory buffer.
Upvotes: 4
Reputation: 26358
Another much used component is DCPCrypt:
http://www.cityinthesky.co.uk/opensource/dcpcrypt
It is stream based, so you can layer compression and encryption. I don't know code that does it in one step. (at least not with sensible encryption)
Upvotes: 6