压缩友好加密
我需要存储一大堆加密文件。他们的小组有非常相似的内容。我想使用压缩来优化所需的空间,但我发现没有适合于此的加密算法。然而,有一个工具可以做到这一点: rsyncrypto 。但是,该许可证使我无法使用它,而且我没有专业知识来研究其实现并编写自己的实现。我正在寻找的是任何可以使用的加密算法,它可以做同样的事情:假设使用相同的密钥,为相似的输入提供相似的输出。降低的加密强度是可以接受的。
I'm going to need to store a whole bunch of encrypted files. Groups of them have very similar content. I would like to optimize the space required using compression, but no encryption algorithm I found is suitable for this. There is, however, a tool out there that is able to do this: rsyncrypto. The license makes it impossible for me to use it, though, and I don't have the expertise to study its implementation and write my own. What I'm looking for is any ready to use encryption algorithm that does the same thing: give similar output for similar input, given that the same key is used. The reduced encryption strength is acceptable.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
rsynccrypto 使用的算法描述如下:
http://rsyncrypto.lingnu.com/index.php/Algorithm
本质是根据一些本地的、翻译不变的标准将文件分成块,然后分别加密这些块。
该算法看起来不是很复杂,几个小时内你应该就能实现它。
如果相同的内容在文件中保持相同的偏移量,您可以使用更简单的算法:
将文件划分为恒定大小的块(例如 64KiB),并使用 CBC 单独加密这些块。或者只使用专为磁盘加密设计的模式,例如 XTS。
The algorithm used by rsyncrypto is described at:
http://rsyncrypto.lingnu.com/index.php/Algorithm
The essence is that divides the file into blocks based on some local, translation invariant criteria, and then encrypts the blocks separately.
The algorithm doesn't look very complicated, and you should be able to implement it in a few hours.
If the same content stays at the same offset in a file, you can get away with an even simpler algorithm:
Divide the file into constant sized blocks (say 64KiB), and encrypt those blocks separately using CBC. Or just use a mode designed for disk-encryption like XTS.