I am designing a cryptographic protocol, and I was wondering whether or not there exists a simple cryptographic operation $\diamond$ that is:
- Associative: $(x\diamond y)\diamond z = x \diamond(y\diamond z)$
- Non-commutative: $x\neq y \Rightarrow x\diamond y \neq y \diamond x$
- Collision-resistant: it's hard to find two different pairs $(x,y)$ and $(x',y')$ such that $x \diamond y = x' \diamond y'$.
The obvious operation that fits these properties is concatentation with some sort of unique separator, and that's indeed what I'm currently using in my protocol.
But is there such an "append-like" binary operation that produces a fixed-size result? Append-and-hash wouldn't work since it is not associative: $H(H(x||y)||z)\neq H(x||H(y||z))$. XOR won't work since it's neither unique nor non-commutative. Ideally such an operation would be a simple construction using a hash function or other "standard" crypto primitive.