diff options
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; |