summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-07-20 21:42:11 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-07-22 12:55:14 +0200
commit1c568d65ac285d2771f20429bbab4944c6dfd69b (patch)
tree88c63c3953176ab2ac2cbdca1bbacd79272e54f4
parentutil: make siphash24_compress_boolean() inline (diff)
downloadsystemd-1c568d65ac285d2771f20429bbab4944c6dfd69b.tar.xz
systemd-1c568d65ac285d2771f20429bbab4944c6dfd69b.zip
util: introduce siphash24_compress_string()
-rw-r--r--src/basic/siphash24.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/basic/siphash24.h b/src/basic/siphash24.h
index d29058e51d..7f799ede3d 100644
--- a/src/basic/siphash24.h
+++ b/src/basic/siphash24.h
@@ -25,6 +25,13 @@ static inline void siphash24_compress_boolean(bool in, struct siphash *state) {
siphash24_compress(&i, sizeof i, state);
}
+static inline void siphash24_compress_string(const char *in, struct siphash *state) {
+ if (!in)
+ return;
+
+ siphash24_compress(in, strlen(in), state);
+}
+
uint64_t siphash24_finalize(struct siphash *state);
uint64_t siphash24(const void *in, size_t inlen, const uint8_t k[static 16]);