summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/hashmap.c2
-rw-r--r--src/basic/siphash24.c9
-rw-r--r--src/basic/siphash24.h4
3 files changed, 8 insertions, 7 deletions
diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c
index d88ceb40aa..6e501ef6ff 100644
--- a/src/basic/hashmap.c
+++ b/src/basic/hashmap.c
@@ -380,7 +380,7 @@ static unsigned base_bucket_hash(HashmapBase *h, const void *p) {
h->hash_ops->hash(p, &state);
- siphash24_finalize(&hash, &state);
+ hash = siphash24_finalize(&state);
return (unsigned) (hash % n_buckets(h));
}
diff --git a/src/basic/siphash24.c b/src/basic/siphash24.c
index 485e0059cb..d2e4077f8a 100644
--- a/src/basic/siphash24.c
+++ b/src/basic/siphash24.c
@@ -140,7 +140,7 @@ void siphash24_compress(const void *_in, size_t inlen, struct siphash *state) {
}
}
-void siphash24_finalize(uint64_t *out, struct siphash *state) {
+uint64_t siphash24_finalize(struct siphash *state) {
uint64_t b;
b = state->padding | (( ( uint64_t )state->inlen ) << 56);
@@ -169,14 +169,15 @@ void siphash24_finalize(uint64_t *out, struct siphash *state) {
sipround(state);
sipround(state);
- *(le64_t*)out = htole64(state->v0 ^ state->v1 ^ state->v2 ^ state->v3);
+ return state->v0 ^ state->v1 ^ state->v2 ^ state->v3;
}
/* SipHash-2-4 */
-void siphash24(uint64_t *out, const void *_in, size_t inlen, const uint8_t k[16]) {
+uint64_t siphash24(const void *_in, size_t inlen, const uint8_t k[16]) {
struct siphash state;
siphash24_init(&state, k);
siphash24_compress(_in, inlen, &state);
- siphash24_finalize(out, &state);
+
+ return siphash24_finalize(&state);
}
diff --git a/src/basic/siphash24.h b/src/basic/siphash24.h
index dc08077d53..0e072eba36 100644
--- a/src/basic/siphash24.h
+++ b/src/basic/siphash24.h
@@ -14,6 +14,6 @@ struct siphash {
void siphash24_init(struct siphash *state, const uint8_t k[16]);
void siphash24_compress(const void *in, size_t inlen, struct siphash *state);
-void siphash24_finalize(uint64_t *out, struct siphash *state);
+uint64_t siphash24_finalize(struct siphash *state);
-void siphash24(uint64_t *out, const void *in, size_t inlen, const uint8_t k[16]);
+uint64_t siphash24(const void *in, size_t inlen, const uint8_t k[16]);