summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c6
1 files changed, 3 insertions, 3 deletions
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;