Reworked domain classification based on binary filters

This commit is contained in:
Luca Deri
2023-09-02 19:16:40 +02:00
parent 854c2d80f1
commit 1d480c18e3
8 changed files with 329 additions and 310 deletions
+22
View File
@@ -62,6 +62,28 @@ u_int32_t ndpi_hash_string(char *str) {
/* ******************************************************************** */
u_int32_t ndpi_rev_hash_string(char *str) {
u_int32_t hash, i;
int len = strlen(str);
if(len == 0) return(0);
len--;
for(hash = i = 0; len >= 0; len--) {
hash += str[len];
hash += (hash << 10);
hash ^= (hash >> 6);
}
hash += (hash << 3);
hash ^= (hash >> 11);
hash += (hash << 15);
return(hash);
}
/* ******************************************************************** */
/* Same as above but with strings with lenght */
u_int32_t ndpi_hash_string_len(char *str, u_int len) {
u_int32_t hash, i;