1 /* 2 * Copyright (c) 2018-2019 Hanspeter Portner (dev@open-music-kontrollers.ch) 3 * 4 * This is free software: you can redistribute it and/or modify 5 * it under the terms of the Artistic License 2.0 as published by 6 * The Perl Foundation. 7 * 8 * This source is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * Artistic License 2.0 for more details. 12 * 13 * You should have received a copy of the Artistic License 2.0 14 * along the source as a COPYING file. If not, obtain it from 15 * http://www.perlfoundation.org/artistic_license_2_0. 16 */ 17 18 #ifndef _D2TK_HASH_H 19 #define _D2TK_HASH_H 20 21 #include <stdint.h> 22 #include <unistd.h> 23 24 #include <d2tk/d2tk.h> 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 typedef struct _d2tk_hash_dict_t d2tk_hash_dict_t; 31 32 struct _d2tk_hash_dict_t { 33 const void *key; 34 size_t len; 35 }; 36 37 D2TK_API uint64_t 38 d2tk_hash(const void *data, size_t nbytes); 39 40 D2TK_API uint64_t 41 d2tk_hash_foreach(const void *data, size_t nbytes, ...) __attribute__((sentinel)); 42 43 D2TK_API uint64_t 44 d2tk_hash_dict(const d2tk_hash_dict_t *dict); 45 46 #ifdef __cplusplus 47 } 48 #endif 49 50 #endif // _D2TK_HASH_H 51