diff options
author | Paul Duncan <pabs@pablotron.org> | 2016-08-28 02:45:06 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2016-08-28 02:45:06 -0400 |
commit | ef52728f7e7461cab37ee3cbc3ef9b0d7e328c65 (patch) | |
tree | 2da588a094dfdc95cebb75ed0a029dcb0b90aaf0 /hash.c | |
parent | 1367fe1bafa1b877f4f92361294eab3a1dd3c11c (diff) | |
download | libfhp-ef52728f7e7461cab37ee3cbc3ef9b0d7e328c65.tar.bz2 libfhp-ef52728f7e7461cab37ee3cbc3ef9b0d7e328c65.zip |
add header value parser, fix hashing
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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; |