diff options
| author | Michael Biebl <biebl@debian.org> | 2018-06-04 00:07:45 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2018-06-04 00:07:45 +0200 |
| commit | 04bc9e1cd3544445d883ad29ea108c1645c8e7b7 (patch) | |
| tree | d10c354b1b980ca8a7b9e48ec9019e8ed88bde2b /shared/nm-utils/nm-hash-utils.h | |
| parent | ee9c73a923909e23a649407be77e25235d769e25 (diff) | |
New upstream version 1.11.4 upstream/1.11.4
Diffstat (limited to 'shared/nm-utils/nm-hash-utils.h')
| -rw-r--r-- | shared/nm-utils/nm-hash-utils.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/shared/nm-utils/nm-hash-utils.h b/shared/nm-utils/nm-hash-utils.h index 276e1ebe..b7742e0f 100644 --- a/shared/nm-utils/nm-hash-utils.h +++ b/shared/nm-utils/nm-hash-utils.h @@ -22,15 +22,17 @@ #ifndef __NM_HASH_UTILS_H__ #define __NM_HASH_UTILS_H__ -#include "siphash24.h" +#include "c-siphash/src/c-siphash.h" #include "nm-macros-internal.h" struct _NMHashState { - struct siphash _state; + CSipHash _state; }; typedef struct _NMHashState NMHashState; +guint nm_hash_static (guint static_seed); + void nm_hash_init (NMHashState *state, guint static_seed); static inline guint @@ -40,7 +42,7 @@ nm_hash_complete (NMHashState *state) nm_assert (state); - h = siphash24_finalize (&state->_state); + h = c_siphash_finalize (&state->_state); /* we don't ever want to return a zero hash. * @@ -55,7 +57,7 @@ nm_hash_update (NMHashState *state, const void *ptr, gsize n) nm_assert (ptr); nm_assert (n > 0); - siphash24_compress (ptr, n, &state->_state); + c_siphash_append (&state->_state, ptr, n); } #define nm_hash_update_val(state, val) \ @@ -166,7 +168,7 @@ nm_hash_update_mem (NMHashState *state, const void *ptr, gsize n) * instead. */ nm_hash_update (state, &n, sizeof (n)); if (n > 0) - siphash24_compress (ptr, n, &state->_state); + c_siphash_append (&state->_state, ptr, n); } static inline void @@ -207,4 +209,15 @@ guint nm_direct_hash (gconstpointer str); guint nm_hash_str (const char *str); guint nm_str_hash (gconstpointer str); +/*****************************************************************************/ + +/* nm_pstr_*() are for hashing keys that are pointers to strings, + * that is, "const char *const*" types, using strcmp(). */ + +guint nm_pstr_hash (gconstpointer p); + +gboolean nm_pstr_equal (gconstpointer a, gconstpointer b); + +/*****************************************************************************/ + #endif /* __NM_HASH_UTILS_H__ */ |