Now I have some sets of integers, say:

```
set1 = {int1, int2, int3};
set2 = {int2, int3, int1};
set3 = {int1, int4, int2};
```

The order or the numbers is not taken into consideration, so set1 and set2 are the same, while set3 are not with the other two.

Now I want to generate a unique key for these sets to distinguish them, in that way, set1 and set2 should generate the same key.

I think this for a while, thoughts as sum up the integers came to my mind but can be easily proved wrong. Sort the set and do

```
key = n1 + n2*2^16 + n3*2^32
```

may be a possible way but I wonder if this can be solved more elegantly. The key can be either integer or string.

So any one has some idea about solving this as fast as possible? Or any reading material is welcome.

More info: The numbers are in fact colors so each integer is less than 0xffffff