X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=src%2Flibelogind%2Fsd-id128%2Fid128-util.c;fp=src%2Flibelogind%2Fsd-id128%2Fid128-util.c;h=337eae24b45132adfd5c8f1ba6f7dfe7e094ca36;hb=3c4743e938878986b5fd89119d1d050658b8024e;hp=c3f527d6570f83d7ad323e42fec039b5c4303418;hpb=e234cf302eeeb19e4689639a980895d7257fa77a;p=elogind.git diff --git a/src/libelogind/sd-id128/id128-util.c b/src/libelogind/sd-id128/id128-util.c index c3f527d65..337eae24b 100644 --- a/src/libelogind/sd-id128/id128-util.c +++ b/src/libelogind/sd-id128/id128-util.c @@ -192,3 +192,16 @@ int id128_write(const char *p, Id128Format f, sd_id128_t id, bool do_sync) { return id128_write_fd(fd, f, id, do_sync); } + +void id128_hash_func(const void *p, struct siphash *state) { + siphash24_compress(p, 16, state); +} + +int id128_compare_func(const void *a, const void *b) { + return memcmp(a, b, 16); +} + +const struct hash_ops id128_hash_ops = { + .hash = id128_hash_func, + .compare = id128_compare_func, +};