From a515dfb3b8f8e999362db7a6b52b3104c03b750a Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 1 Nov 2024 23:46:08 -0400 Subject: Import quark sources Signed-off-by: Ian Moffett --- include/hash.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 include/hash.h (limited to 'include/hash.h') diff --git a/include/hash.h b/include/hash.h new file mode 100644 index 0000000..f39c6da --- /dev/null +++ b/include/hash.h @@ -0,0 +1,21 @@ +/* + * 32-bit FNV-1a hash function. + * Copyright (c) 2023-2024, Quinn Stephens and the OSMORA team. + * Provided under the BSD 3-Clause license. + */ + +#ifndef _HASH_H +#define _HASH_H + +#include +#include + +#define FNV_PRIME 0x01000193 +#define FNV_OFFSET_BASIS 0x811c9dc5 + +typedef uint32_t hash_t; + +hash_t hash_data(const void *data, size_t length); +hash_t hash_string(const char *str); + +#endif /* !_HASH_H */ -- cgit v1.2.3