summaryrefslogtreecommitdiff
path: root/tables
diff options
context:
space:
mode:
authorfanf <fanf@13f79535-47bb-0310-9956-ffa450edef68>2001-03-22 17:35:08 +0000
committerfanf <fanf@13f79535-47bb-0310-9956-ffa450edef68>2001-03-22 17:35:08 +0000
commit36c502f1ac030e60d1c1f4cd85671b6b7521fd0e (patch)
tree93ec952da92fc72e0640314d65d8ced3c9efc6df /tables
parentc0e57cee9ea52390e9c07ea051957c32b9c92e81 (diff)
downloadlibapr-36c502f1ac030e60d1c1f4cd85671b6b7521fd0e.tar.gz
better hash function citation
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61375 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tables')
-rw-r--r--tables/apr_hash.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/tables/apr_hash.c b/tables/apr_hash.c
index 8085ee33f..4da402016 100644
--- a/tables/apr_hash.c
+++ b/tables/apr_hash.c
@@ -222,11 +222,17 @@ static apr_hash_entry_t **find_entry(apr_hash_t *ht,
klen = strlen(key);
/*
- * This is Daniel J. Bernstein's popular `times 33' hash function
- * as posted by him years ago on comp.lang.c and used by perl.
- * This is one of the best known hash functions for strings
- * because it is both computed very fast and distributes very
- * well.
+ * This is the popular `times 33' hash algorithm which is used by
+ * perl and also appears in Berkeley DB. This is one of the best
+ * known hash functions for strings because it is both computed
+ * very fast and distributes very well.
+ *
+ * The originator may be Dan Bernstein but the code in Berkeley DB
+ * cites Chris Torek as the source. The best citation I have found
+ * is "Chris Torek, Hash function for text in C, Usenet message
+ * <27038@mimsy.umd.edu> in comp.lang.c , October, 1990." in Rich
+ * Salz's USENIX 1992 paper about INN which can be found at
+ * <http://citeseer.nj.nec.com/salz92internetnews.html>.
*
* The magic of number 33, i.e. why it works better than many other
* constants, prime or not, has never been adequately explained by
@@ -248,9 +254,8 @@ static apr_hash_entry_t **find_entry(apr_hash_t *ht,
* operation can be replaced by a faster operation based on just one
* shift plus either a single addition or subtraction operation. And
* because a hash function has to both distribute good _and_ has to
- * be very fast to compute, those few numbers should be preferred
- * and seems to be the reason why Daniel J. Bernstein also preferred
- * it.
+ * be very fast to compute, those few numbers should be preferred.
+ *
* -- Ralf S. Engelschall <rse@engelschall.com>
*/
hash = 0;