Delphi 中的压缩和加密
我的 DAT
文件需要一种快速且强大的压缩+加密方法。
我有一个 DAT
文件,其中包含非常敏感的信息,我想对其进行压缩和加密。我知道我可以在压缩方法中使用 Zlib,但是加密方法也可以吗?
非常感谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请查看 Delphi 加密纲要(又名 DEC):
Please check out the Delphi Encryption Compendium (aka DEC):
另一个常用的组件是 DCPCrypt:
http://www.cityinthesky.co.uk/opensource/dcpcrypt< /a>
它是基于流的,因此您可以分层压缩和加密。我不知道一步完成此操作的代码。 (至少没有使用合理的加密)
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)
如果您同时需要加密和压缩,则有两种实现方法:
在所有情况下,最好是在加密之前进行压缩。从压缩格式中解密数据更加困难,因为其内容不太可预期。
然后依靠足够强大的加密算法(如 AES)。
您在我们的开源单元(从 Delphi 5 到 XE2)中拥有所有这些功能。您可以使用 ZIP,或者尝试我们的速度更快(但压缩比效率较低)SynLZ。然后可以使用 SynCrypto 对其进行加密。有直接函数处理
RawByteString
类型的数据,这些数据将数据存储在内存缓冲区中。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.