summaryrefslogtreecommitdiff
path: root/src/basic/siphash24.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-17 00:32:06 +0100
committerLennart Poettering <lennart@poettering.net>2015-11-17 00:32:06 +0100
commit357bc17975e3a60a64c46f56b5330747c67705b2 (patch)
treea433ef446817659ae3a4fc8c60f2adb68082650d /src/basic/siphash24.c
parent8702319e119008954baa872d50d0e4098e6e83db (diff)
parent933f9caeeb2b3c1b951d330e04beb04226e5a890 (diff)
Merge pull request #1923 from zonque/siphash
siphash24: let siphash24_finalize() and siphash24() return the result…
Diffstat (limited to 'src/basic/siphash24.c')
-rw-r--r--src/basic/siphash24.c9
1 files changed, 5 insertions, 4 deletions
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);
}