From bc9f312c67c0a76f1de0ceaea53c874fb8773cc8 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 9 Dec 2009 16:30:10 +0100 Subject: [PATCH] hashed match: Use a different (larger) prime number. The previous prime number, 251, did not distribute good enough into three groups. --- src/match_hashed.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/match_hashed.c b/src/match_hashed.c index 062a7a72..4d533050 100644 --- a/src/match_hashed.c +++ b/src/match_hashed.c @@ -158,8 +158,8 @@ static int mh_match (const data_set_t __attribute__((unused)) *ds, /* {{{ */ for (host_ptr = vl->host; *host_ptr != 0; host_ptr++) { - /* 251 is the largest prime smaller than 256. */ - hash_val = (hash_val * 251) + ((uint32_t) *host_ptr); + /* 2184401929 is some appropriately sized prime number. */ + hash_val = (hash_val * 2184401929) + ((uint32_t) *host_ptr); } DEBUG ("hashed match: host = %s; hash_val = %"PRIu32";", vl->host, hash_val); -- 2.30.2