diff --git a/djb2.c b/djb2.c index a468f97..552c540 100644 --- a/djb2.c +++ b/djb2.c @@ -1,15 +1,14 @@ #include +/* + * Simple hash function djb2, as in Daniel J. Berenstein. + */ + unsigned long djb2(const char *str) { unsigned long h = 5381; int c; - while ((c = *str++)) { - h = ((h << 5) + h) + c; - - // Essentially equal to: - // h = h * 33 + c; - } + while ((c = *str++)) h = ((h << 5) + h) + c; // h = h * 33 + c; return h; }