From 262c15250485395b49e6c99d972906e1b11cfb74 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Wed, 11 Jun 2003 13:03:30 +0000 Subject: [PATCH] Oops, the hash function for fingerprints was terribly biased. There should be XOR, not OR. Also, the shifts are meaningless, because the fingerprint hash is believed to be very well distributed. Beware, this means that the current mainline is incompatible with string indices generated by v2.4! For now, I'm not increasing the index version, because word matching still works with old indices and I want to profile it. --- lib/index.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/index.h b/lib/index.h index 164383bc..cd794c93 100644 --- a/lib/index.h +++ b/lib/index.h @@ -105,7 +105,7 @@ void fingerprint(byte *string, struct fingerprint *fp); static inline u32 fp_hash(struct fingerprint *fp) { - return (fp->hash[0] << 24) | (fp->hash[1] << 16) | (fp->hash[2] << 8) | fp->hash[3]; + return fp->hash[0] ^ fp->hash[1] ^ fp->hash[2] ^ fp->hash[3]; } /* Reading of tagged text (Unicode values, tags mapped to 0x80000000 and higher) */ -- 2.39.2