1

Does a non commutative homomorphic hash function exist (or been researched/published)? LtHash developed by Facebook and implemented on Github here is the sort of function I am looking for, but LtHash commutes and I'd like to know if there is a non commutative hashing algorithm.

I have had a look online and so far not found any hashing functions (or even better implementations) that are both homomorphic and non commutative.

Tobias
  • 13
  • 3
  • Just do the hash and follow with a permutation? – btilly Jun 21 '23 at 16:46
  • What kind of operation the hash function is going to preserve? – Stanislav Volodarskiy Jun 21 '23 at 22:21
  • @StanislavVolodarskiy An example use case: Suppose directed graph traversal and consider the hashes of paths. Say we have already found a path of nodes [C->..->Z] and computed its hash H(C->..->Z). We now find a new path [A->B->C]. So by concatenating we know there exists a path [A->..->Z]. Instead of computing the whole hash of A to Z from scratch, if H homomorphic, we'd only need to compute H(A->B) then H(A->...->Z) = H(A->B) + H(C->..->Z) for some operation [+]. Obviously [A->B->C] doesn't imply [B->A->C] so we don't want H(A->B)=H(B->A), hence the need for it to be non commutative! – Tobias Jun 21 '23 at 23:15
  • Associate hashes with edges of graph. Combine edge hashes along path. Providing "combine" operation is associative non-commutative you've got desired construction. – Stanislav Volodarskiy Jun 22 '23 at 06:56

1 Answers1

1

LtHash only commutes if you leave out the block indexes, but that makes it also insecure. I guess you left them out, because you want to be able to concatenate hashes as in your graph example comment.

In order to do that with LtHash, you can use the first block and pairs of adjacent blocks instead of pairs of blocks with indexes.

For example, the LtHash of [a,b,c,d,e] would normally be sum([ h([0,a]), h([1,b]), h([2,c]), h([3,d]), h([4,e]) ])

Instead, you can use sum([ h(a), h([a,b]), h([b,c]), h([c,d]), h([d,e]) ]).

Now you can concatenate hashes if you know the starting and ending blocks:

Hash([a,b,c,d,e,f]) = Hash([a,b,c]) + Hash([d,e,f]) + h([c,d]) - h(d)

Matt Timmermans
  • 53,709
  • 3
  • 46
  • 87