New ndpi_sha256() nDPI API call (#2230)

* Added ndpi_sha256.c to the Windows project

* Added ndpi_sha256() nDPI API call
This commit is contained in:
Luca Deri
2023-12-23 10:47:28 +01:00
committed by GitHub
parent f2be972224
commit 99d4838328
6 changed files with 27 additions and 17 deletions
+11
View File
@@ -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;