/// <summary> /// The long hashcode is computed by using MD5 in order to prevent problems with poorly /// implemented predicate object hashcodes. /// </summary> /// <returns>The long hashcode of the predicate.</returns> public override long GetLongHashCode() { int hashCode = GetType().GetHashCode() ^ Value.GetHashCode(); // bug #1086498, solved by mwherman2000 byte[] dataArray = new byte[] { (byte)(hashCode & 0xFF), (byte)((hashCode >> 8) & 0xFF), (byte)((hashCode >> 16) & 0xFF), (byte)((hashCode >> 24) & 0xFF) }; byte[] result = HA.ComputeHash(dataArray); long longHashCode = 0; for (int i = 0; i < 16; i += 8) { longHashCode ^= ((long)result[i] | ((long)result[i + 1] << 8) | ((long)result[i + 2] << 16) | ((long)result[i + 3] << 24) | ((long)result[i + 4] << 32) | ((long)result[i + 5] << 40) | ((long)result[i + 6] << 48) | ((long)result[i + 7] << 56)); } return(longHashCode); }
protected virtual byte[] GetKey(string key) { return(HA.ComputeHash(key.FromUTF8String())); }