summaryrefslogtreecommitdiff
path: root/include/hash.h
blob: f39c6daa3467cfc342dd7b221e0d3f7faa884dde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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 <stdint.h>
#include <stdlib.h>

#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 */