aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ndpi_hash.c')
-rw-r--r--src/lib/ndpi_hash.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/ndpi_hash.c b/src/lib/ndpi_hash.c
index 8d78749fd..8dd7beab0 100644
--- a/src/lib/ndpi_hash.c
+++ b/src/lib/ndpi_hash.c
@@ -48,6 +48,21 @@ u_int32_t ndpi_quick_hash(unsigned char *str, u_int str_len) {
/* ******************************************************************** */
+/* Based on Daniel Lemire code */
+u_int64_t ndpi_quick_hash64(char *str, u_int str_len) {
+ u_int64_t h = 0;
+ u_int i;
+
+ for(i=0; i<str_len; i++)
+ h = (h * 177) + str[i];
+
+ h ^= strlen(str);
+
+ return h;
+}
+
+/* ******************************************************************** */
+
/*
https://en.wikipedia.org/wiki/Jenkins_hash_function