/*
SipHash reference C implementation
Written in 2012 by
Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com>
Daniel J. Bernstein <djb@cr.yp.to>
To the extent possible under law, the author(s) have dedicated all copyright
and related and neighboring rights to this software to the public domain
worldwide. This software is distributed without any warranty.
You should have received a copy of the CC0 Public Domain Dedication along with
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
(Minimal changes made by Lennart Poettering, to make clean for inclusion in systemd)
(Refactored by Tom Gundersen to split up in several functions and follow systemd
coding style)
*/
#include "macro.h"
#include "siphash24.h"
#include "unaligned.h"
assert(b < 64);
return (x << b) | (x >> (64 - b));
}
}
assert(k);
k0 = unaligned_read_le64(k);
/* "somepseudorandomlygeneratedbytes" */
.padding = 0,
.inlen = 0,
};
}
uint64_t m;
/* Update total length */
/* If padding exists, fill it out */
if (left > 0) {
/* We did not have enough input to fill out the padding completely */
return;
#ifdef DEBUG
printf("(%3zu) compress padding %08x %08x\n", state->inlen, (uint32_t) (state->padding >> 32), (uint32_t)state->padding);
#endif
}
m = unaligned_read_le64(in);
#ifdef DEBUG
#endif
}
switch (left) {
case 7:
case 6:
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:
break;
}
}
uint64_t b;
#ifdef DEBUG
printf("(%3zu) padding %08x %08x\n", state->inlen, (uint32_t) (state->padding >> 32), (uint32_t) state->padding);
#endif
#ifdef DEBUG
#endif
}
assert(k);
siphash24_init(&state, k);
return siphash24_finalize(&state);
}