I have the following problem that I'm trying to think of an efficient solution for.
Suppose I have a set of unordered keys (KEY_1, KEY_5, KEY_2, KEY_4), and I want to calculate a unique hash for this set. Is there an easy way to do this in Solidity using data structures / types that are fairly efficient?
One approach would be to order the keys and then take the hash, but this involves sorting the keys which is not ideal (i.e. O(n*log(n))).
Is there a better approach?