Skip to content

Commit

Permalink
Make siphash24 available internally
Browse files Browse the repository at this point in the history
  • Loading branch information
greghudson committed May 31, 2019
1 parent 925a7df commit 4662f94
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/include/k5-hashtab.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,7 @@ int k5_hashtab_remove(struct k5_hashtab *ht, const void *key, size_t klen);
/* Retrieve a value from a hash table by key. */
void *k5_hashtab_get(struct k5_hashtab *ht, const void *key, size_t klen);

uint64_t k5_siphash24(const uint8_t *data, size_t len,
const uint8_t seed[K5_HASH_SEED_LEN]);

#endif /* K5_HASH_H */
9 changes: 9 additions & 0 deletions src/util/support/hashtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,15 @@ siphash24(const uint8_t *data, size_t len, uint64_t k0, uint64_t k1)
return v0 ^ v1 ^ v2 ^ v3;
}

uint64_t
k5_siphash24(const uint8_t *data, size_t len,
const uint8_t seed[K5_HASH_SEED_LEN])
{
uint64_t k0 = load_64_le(seed), k1 = load_64_le(seed + 8);

return siphash24(data, len, k0, k1);
}

int
k5_hashtab_create(const uint8_t seed[K5_HASH_SEED_LEN], size_t initial_buckets,
struct k5_hashtab **ht_out)
Expand Down
1 change: 1 addition & 0 deletions src/util/support/libkrb5support-fixed.exports
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ k5_once
k5_path_isabs
k5_path_join
k5_path_split
k5_siphash24
k5_strerror_r
k5_utf8_to_utf16le
k5_utf16le_to_utf8
Expand Down

0 comments on commit 4662f94

Please sign in to comment.