summaryrefslogtreecommitdiff
path: root/src/libstddjb/cdb_hashv.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstddjb/cdb_hashv.c')
-rw-r--r--src/libstddjb/cdb_hashv.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libstddjb/cdb_hashv.c b/src/libstddjb/cdb_hashv.c
new file mode 100644
index 0000000..e2b80d9
--- /dev/null
+++ b/src/libstddjb/cdb_hashv.c
@@ -0,0 +1,14 @@
+/* ISC license. */
+
+#include <stdint.h>
+
+#include "cdb-internal.h"
+
+uint32_t cdb_hashv (struct iovec const *v, unsigned int n)
+{
+ uint32_t h = CDB_HASHSTART ;
+ for (unsigned int i = 0 ; i < n ; i++)
+ for (size_t j = 0 ; j < v[i].iov_len ; j++)
+ h = cdb_hashadd(h, ((uint8_t const *)v[i].iov_base)[j]) ;
+ return h ;
+}