Return-Path: X-Original-To: apmail-apr-dev-archive@www.apache.org Delivered-To: apmail-apr-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D44D999D0 for ; Sun, 29 Jan 2012 12:57:04 +0000 (UTC) Received: (qmail 31654 invoked by uid 500); 29 Jan 2012 12:57:04 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 31586 invoked by uid 500); 29 Jan 2012 12:57:03 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 31578 invoked by uid 99); 29 Jan 2012 12:57:03 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 29 Jan 2012 12:57:03 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of bojan@rexursive.com designates 150.101.121.179 as permitted sender) Received: from [150.101.121.179] (HELO beauty.rexursive.com) (150.101.121.179) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 29 Jan 2012 12:56:57 +0000 Received: from [10.1.120.43] (noknok.rexursive.com [10.1.120.43]) by beauty.rexursive.com (Postfix) with ESMTPSA id 148471A8C55; Sun, 29 Jan 2012 23:56:35 +1100 (EST) Subject: Re: svn commit: r1237078 - /apr/apr/trunk/tables/apr_hash.c Date: Sun, 29 Jan 2012 23:56:31 +1100 From: "Bojan Smojver" To: rpluem@apache.org Cc: dev@apr.apache.org MIME-Version: 1.0 X-Mailer: LCG ProfiMail 3.55 Message-ID: <8361800055.1012348591@rexursive.com> References: <20120128155422.BCF80238890B@eris.apache.org> <4F253CEB.5020002@apache.org> Content-Type: text/plain; charset=utf-8; format=flowed ------- Original message ------- > From: Ruediger Pluem > Don't we have the same issue here as with the XOR version of the patch? > If two different keys (key1, key2) result in the same hash value (so > ht->hash_func(key1, &klen1) == ht->hash_func(key2, > &klen2);) doesn't hashfunc_default result in the same hash value for both > keys since the input value to hash > is the same? For two keys to cause a collision, the modulo (i.e. the index) has to be the same, not necessarily the whole hash. So, with xor, we don't gain anything by using seed against the final hash (modulo will change, but in the same way for both hash values - the collision will move to a different bucket). With the hash function, as long as the hash is not completely the same, we will most likely get a different modulo and therefore a different index into the table. Make sense? -- Bojan