1 /* 2 * Copyright (C) 2021 Alexandros Theodotou <alex at zrythm dot org> 3 * 4 * This file is part of Zrythm 5 * 6 * Zrythm is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU Affero General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * Zrythm is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU Affero General Public License for more details. 15 * 16 * You should have received a copy of the GNU Affero General Public License 17 * along with Zrythm. If not, see <https://www.gnu.org/licenses/>. 18 */ 19 20 /** 21 * \file 22 * 23 * Hash utils. 24 */ 25 26 #ifndef __UTILS_HASH_H__ 27 #define __UTILS_HASH_H__ 28 29 #include <xxhash.h> 30 31 /** 32 * @addtogroup utils 33 * 34 * @{ 35 */ 36 37 typedef enum HashAlgorithm 38 { 39 HASH_ALGORITHM_XXH32, 40 HASH_ALGORITHM_XXH3_64, 41 } HashAlgorithm; 42 43 char * 44 hash_get_from_file ( 45 const char * filepath, 46 HashAlgorithm algo); 47 48 void * 49 hash_create_state (void); 50 51 void 52 hash_free_state ( 53 void * in_state); 54 55 unsigned int 56 hash_get_for_struct_full ( 57 XXH32_state_t * state, 58 const void * const obj, 59 size_t size); 60 61 unsigned int 62 hash_get_for_struct ( 63 const void * const obj, 64 size_t size); 65 66 /** 67 * @} 68 */ 69 70 #endif 71