Loading [MathJax]/extensions/TeX/AMSsymbols.js
LAL 7.7.0.1-5e288d3
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
LALHashFunc.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 John Veitch
3 * Copyright (C) 2016 Karl Wette
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with with program; see the file COPYING. If not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301 USA
19 */
20
21#ifndef _LALHASHFUNC_H
22#define _LALHASHFUNC_H
23
24#include <lal/LALStdlib.h>
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
30/**
31 * \defgroup LALHashFunc_h Header LALHashFunc.h
32 * \ingroup lal_utilities
33 * \authors John Veitch, Karl Wette
34 * \brief Implementations of various hash functions
35 */
36/** @{ */
37
38/**
39 * \name Pearson hash function
40 */
41/** @{ */
42
43/**
44 * Compute a arbitrary-sized Pearson hash value for the given arbitrary data
45 */
47 void *hval, /**< [in/out] Hash value; should be either zero, or the result
48 of a previous XLALPearsonHash() call when hashing multiple data */
49 const size_t hval_len, /**< [in] Length of hash value */
50 const void *data, /**< [in] Arbitrary data to hash */
51 const size_t data_len /**< [in] Length of arbitrary data */
52);
53
54/** @} */
55
56/**
57 * \name CityHash hash functions
58 */
59/** @{ */
60
61/** Hash function for a byte array. */
62UINT8 XLALCityHash64(const char *buf, size_t len);
63
64/** Hash function for a byte array. For convenience, a 64-bit seed is also
65 * hashed into the result.
66 */
67UINT8 XLALCityHash64WithSeed(const char *buf, size_t len, UINT8 seed);
68
69/** Hash function for a byte array. For convenience, two seeds are also
70 * hashed into the result.
71 */
72UINT8 XLALCityHash64WithSeeds(const char *buf, size_t len,
73 UINT8 seed0, UINT8 seed1);
74
75/** Hash function for a byte array. Most useful in 32-bit binaries. */
76UINT4 XLALCityHash32(const char *buf, size_t len);
77
78/** @} */
79
80/** @} */
81
82#ifdef __cplusplus
83}
84#endif
85
86#endif // _LALHASHFUNC_H
uint64_t UINT8
Eight-byte unsigned integer; on some platforms this is equivalent to unsigned long int instead.
uint32_t UINT4
Four-byte unsigned integer.
int XLALPearsonHash(void *hval, const size_t hval_len, const void *data, const size_t data_len)
Compute a arbitrary-sized Pearson hash value for the given arbitrary data.
UINT8 XLALCityHash64WithSeeds(const char *buf, size_t len, UINT8 seed0, UINT8 seed1)
Hash function for a byte array.
Definition: LALCityHash.c:431
UINT8 XLALCityHash64(const char *buf, size_t len)
Hash function for a byte array.
Definition: LALCityHash.c:389
UINT4 XLALCityHash32(const char *buf, size_t len)
Hash function for a byte array.
Definition: LALCityHash.c:211
UINT8 XLALCityHash64WithSeed(const char *buf, size_t len, UINT8 seed)
Hash function for a byte array.
Definition: LALCityHash.c:427