How do I calculate a good hash code for a list of strings?

后端 未结 11 1594
我寻月下人不归
我寻月下人不归 2020-12-01 02:34

Background:

  • I have a short list of strings.
  • The number of strings is not always the same, but are nearly always of the order of a “handful”
  • I
11条回答
  •  被撕碎了的回忆
    2020-12-01 03:24

    I see no reason not to concatenate the strings and compute the hashcode for the concatenation.

    As an analogy, say that I wanted to compute a MD5 checksum for a memory block, I wouldn't split the block up into smaller pieces and compute individual MD5 checksums for them and then combine them with some ad hoc method.

提交回复
热议问题