Minor hash improvement

This commit is contained in:
Luca Deri
2024-02-04 20:23:49 +01:00
parent b59994fa20
commit b15b877c51
+2 -3
View File
@@ -48,13 +48,12 @@ u_int32_t ndpi_quick_hash(const unsigned char *str, u_int str_len) {
/* ******************************************************************** */ /* ******************************************************************** */
/* Based on Daniel Lemire code */
u_int64_t ndpi_quick_hash64(const char *str, u_int str_len) { u_int64_t ndpi_quick_hash64(const char *str, u_int str_len) {
u_int64_t h = 0; u_int64_t h = 177;
u_int i; u_int i;
for(i=0; i<str_len; i++) for(i=0; i<str_len; i++)
h = (h * 177) + str[i]; h = (h * 31) + str[i];
h ^= str_len; h ^= str_len;