From ef52728f7e7461cab37ee3cbc3ef9b0d7e328c65 Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sun, 28 Aug 2016 02:45:06 -0400 Subject: add header value parser, fix hashing --- hash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'hash.c') diff --git a/hash.c b/hash.c index c35590e..e4bd7c2 100644 --- a/hash.c +++ b/hash.c @@ -13,7 +13,7 @@ fhp_hash_init(void) { uint32_t fhp_hash_push(uint32_t hash, uint8_t * const buf, size_t len) { for (size_t i = 0; i < len; i++) - hash = ((hash << 5) + hash) + buf[len]; + hash = ((hash << 5) + hash) + buf[i]; return hash; } @@ -31,9 +31,9 @@ fhp_lc_hash_push( size_t len ) { for (size_t i = 0; i < len; i++) { - uint8_t c = buf[len]; + uint8_t c = buf[i]; - if (c >= 'A' && c <= 'Z') + if ((c >= 'A') && (c <= 'Z')) c = (c - 'A') + 'a'; hash = ((hash << 5) + hash) + c; -- cgit v1.2.3