質問

I have a requirement stating that data compression and encryption should be performed.

However, I have doubts relating to which step should be performed first in order to optimize compression rate and execution time. How can I choose which step to perform first and the compression and encryption approach to use?

役に立ちましたか?

解決

I would strongly expect an "encrypt then compress" approach to give you almost no compression. Encrypted data shouldn't have any discernable patterns in it, which is basically what compression relies on.

Compress then encrypt.

As for which kind of encryption and compression to use - that entirely depends on your context, which you haven't given any information about. Heck, you may find that your data isn't compressible in the first place.

他のヒント

I think the usual order of doing things is first compress, then encrypt. Good encryption algorithms are rather CPU expensive, so it's better to reduce the size of data first before encrypting.

First you would be performing compression. You can use 7zip libraries for doing that. It does the encryption too, I think AES encryption.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top