]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/siphash24.h
61d83233a58f07fa36963fdd2bb766da8e27eb95
1 /* SPDX-License-Identifier: CC0-1.0 */
16 void siphash24_init(struct siphash
*state
, const uint8_t k
[static 16]);
17 void siphash24_compress(const void *in
, size_t inlen
, struct siphash
*state
);
18 #define siphash24_compress_byte(byte, state) siphash24_compress((const uint8_t[]) { (byte) }, 1, (state))
19 #define siphash24_compress_typesafe(in, state) \
20 siphash24_compress(&(in), sizeof(typeof(in)), (state))
22 static inline void siphash24_compress_boolean(bool in
, struct siphash
*state
) {
23 siphash24_compress_byte(in
, state
);
26 static inline void siphash24_compress_usec_t(usec_t in
, struct siphash
*state
) {
27 uint64_t u
= htole64(in
);
28 siphash24_compress_typesafe(u
, state
);
31 static inline void siphash24_compress_safe(const void *in
, size_t inlen
, struct siphash
*state
) {
35 siphash24_compress(in
, inlen
, state
);
38 void siphash24_compress_string(const char *in
, struct siphash
*state
);
40 uint64_t siphash24_finalize(struct siphash
*state
);
42 uint64_t siphash24(const void *in
, size_t inlen
, const uint8_t k
[static 16]);
44 uint64_t siphash24_string(const char *s
, const uint8_t k
[static 16]);