#include "hashing.h"

#include <xxhash/xxhash.h>
#include <assert.h>

/* XXH32 of "recreational.tech" */
#define HASH32_SEED 0xd9035e35

static_assert(sizeof(rt_hash64) == sizeof(XXH64_hash_t), "Size mismatch between rt_hash64 and XXH64_hash_t!");
static_assert(sizeof(rt_hash32) == sizeof(XXH32_hash_t),
              "Size mismatch between rt_hash32 and XXH32_hash_t!");

RT_DLLEXPORT rt_hash64 rtHashBytes(const void *begin, size_t count) {
    return XXH3_64bits(begin, count);
}


RT_DLLEXPORT rt_hash32 rtHashBytes32(const void *begin, size_t count) {
    return XXH32(begin, count, HASH32_SEED);
}