aboutsummaryrefslogtreecommitdiff
path: root/src/lib/ndpi_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r--src/lib/ndpi_main.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c
index a00f9bdd4..36ec8db5b 100644
--- a/src/lib/ndpi_main.c
+++ b/src/lib/ndpi_main.c
@@ -7244,6 +7244,18 @@ uint8_t ndpi_connection_tracking(struct ndpi_detection_module_struct *ndpi_str,
/* ******************************************************************** */
+ /* Based on djb2 hash - http://www.cse.yorku.ca/~oz/hash.html */
+ u_int32_t ndpi_quick_hash(unsigned char *str, u_int str_len) {
+ u_int32_t hash = 5381, i;
+
+ for(i=0; i<str_len; i++)
+ hash = ((hash << 5) + hash) + str[i]; /* hash * 33 + str[i] */
+
+ return hash;
+ }
+
+ /* ******************************************************************** */
+
void ndpi_md5(const u_char *data, size_t data_len, u_char hash[16]) {
ndpi_MD5_CTX ctx;