From e391d0c1a9a655d030bc3b7da06a3949fe2809c3 Mon Sep 17 00:00:00 2001 From: Tessil Date: Sun, 7 May 2017 12:15:36 +0200 Subject: [PATCH] Bug correction in FNV-1a hash function. --- src/array_hash.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/array_hash.h b/src/array_hash.h index dd55fa9..b3c6fe7 100644 --- a/src/array_hash.h +++ b/src/array_hash.h @@ -79,7 +79,8 @@ struct str_hash { std::size_t hash = init; for (std::size_t i = 0; i < key_size; ++i) { - hash = (hash ^ key[i]) + (hash * multiplier); + hash ^= key[i]; + hash *= multiplier; } return hash;