Generating a good hash code (GetHashCode) for a BitArray
问题 I need to generate a fast hash code in GetHashCode for a BitArray. I have a Dictionary where the keys are BitArrays, and all the BitArrays are of the same length. Does anyone know of a fast way to generate a good hash from a variable number of bits, as in this scenario? UPDATE: The approach I originally took was to access the internal array of ints directly through reflection (speed is more important than encapsulation in this case), then XOR those values. The XOR approach seems to work well