spqlios basic wrapper

This commit is contained in:
Jean-Philippe Bossuat
2025-01-26 12:26:44 +01:00
parent 7e9a9501b5
commit 06e4e58b2d
201 changed files with 30406 additions and 3 deletions

View File

@@ -0,0 +1,24 @@
#include "sha3.h"
#include "test_commons.h"
/** @brief returns some pseudorandom hash of the content */
thash test_hash(const void* data, uint64_t size) {
thash res;
sha3(data, size, &res, sizeof(res));
return res;
}
/** @brief class to return a pseudorandom hash of the content */
test_hasher::test_hasher() {
md = malloc(sizeof(sha3_ctx_t));
sha3_init((sha3_ctx_t*)md, 16);
}
void test_hasher::update(const void* data, uint64_t size) { sha3_update((sha3_ctx_t*)md, data, size); }
thash test_hasher::hash() {
thash res;
sha3_final(&res, (sha3_ctx_t*)md);
return res;
}
test_hasher::~test_hasher() { free(md); }