How to generate a numeric or string id(not very large text) for a sequence of elements where ordering doesn't matter.

Example:
[41,1001,32] should generate the same ID as [32,1001,41]
[41,1001,32, 5] should be different.

Elements could be hundreds where each individual ID can be a 4/5-digit number.

I thought about sorting, concatenate and Hash/Compress the string, but are there gonna be a lot of collisions ?

Any ideas would be much appreciated.

没有正确的解决方案

许可以下: CC-BY-SA归因
不隶属于 cs.stackexchange
scroll top