I need a CRC mechanism to calculate the CRC of a number of strings, such that, given two strings, A and B, the sum crc(A) + crc(B) == crc(A+B).
P.S. XOR is too weak---the algorithm should be not trivial for reverse engineering.
I need a CRC mechanism to calculate the CRC of a number of strings, such that, given two strings, A and B, the sum crc(A) + crc(B) == crc(A+B).
P.S. XOR is too weak---the algorithm should be not trivial for reverse engineering.
I don't think any checksums would fill this condition.
Usually size(CRC(A)) == const (CRC codomain is a limited set, const == size(max_checksum) ).
So if you have message B for which CRC(B) == max_checksum, then for any other message size(CRC(B)) + size(CRC(C)) > const, (from CRC(B) + CRC(C) > max_checksum).
Or to put it differently there is no CRC function that satisfies the requirement.
EDIT:
However, if you meant the you want to be able to determine CRC of two messages together knowing CRC of both individual message, yes this is possible it is used for example by rsync and it is called rolling hash.
Taking your required condition, with + meaning string concatenation on the RHS, and integer addition on the LHS, the checksum of any string would be the sum of the checksums of its individual characters. All such checksums are isomorphic[*], the only tunable parameters are what values you assign to each single char.
If XOR is too weak, then I doubt that any such linear checksum would be strong enough.
If + means anything else in your required condition, perhaps you could specify what...
[*] Well, something-morphic.
Homomorphic hashing comes close to what you're asking for, but I'm not aware of one that works for string contactenation, as opposed to mathematical operations. All known homomorphic hash functions are absurdly slow, too.
I would speculate that it may not even be possible to create a secure hash function that has this property, though.