diff options
Diffstat (limited to 'src/lib/ndpi_main.c')
-rw-r--r-- | src/lib/ndpi_main.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index e80cef78e..0b9b28864 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -124,6 +124,7 @@ /* Third party libraries */ #include "third_party/include/ndpi_patricia.h" #include "third_party/include/ndpi_md5.h" +#include "third_party/include/ndpi_sha256.h" #ifdef HAVE_NBPF #include "nbpf.h" @@ -10092,6 +10093,16 @@ void ndpi_md5(const u_char *data, size_t data_len, u_char hash[16]) { /* ******************************************************************** */ +void ndpi_sha256(const u_char *data, size_t data_len, u_int8_t sha_hash[32]) { + ndpi_SHA256_CTX sha_ctx; + + ndpi_sha256_init(&sha_ctx); + ndpi_sha256_update(&sha_ctx, data, data_len); + ndpi_sha256_final(&sha_ctx, sha_hash); +} + +/* ******************************************************************** */ + static int enough(int a, int b) { u_int8_t percentage = 20; |