4 ms·
Ask HN: Does anyone know how to do incremental multiset hashing in practice?
I have been working on synchronizing databases using a Merkle tree and up until now I have used XOR to incrementally update nodes in the tree.
Now I want to split the single Merkle tree into several trees that can be updated on separate nodes and recombined at a later stage.
This introduces a problem with XOR: if an item is included in two of the Merkle trees its XOR hash will cancel out. So I think I need to be using additive multiset hashes and there are several papers on this approaching the subject from a mathematical point of view but some pseudocode would really help.
Also, what are some of the peculiarities of XOR or OR hashing to be aware of?
Does it help if the hash inputs are of identical length, and strictly unique? How well do XOR or OR fold entropy (if the inputs are well distributed or not)?