#include "hashing.h"

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

/* XXH32/64 of "recreational.tech" with seed 0 */
#define HASH32_SEED 0xd9035e35
#define HASH64_SEED 0xa14e16c3ae8b282dULL

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 XXH64(begin, count, HASH64_SEED);
}


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