Reputation: 6616
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.
Upvotes: 1
Views: 434
Reputation: 108790
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.
Upvotes: 0