1 #ifndef CCAN_SIPHASH_H_
2 #define CCAN_SIPHASH_H_
4 /* Licensed under GPL v2+ - see LICENSE file for details */
5 /* Written in 2013 by Ulrik Sverdrup */
11 * siphash - a keyed hash function
13 * SipHash-c-d, where `c` is the number of rounds per message chunk
14 * and `d` the number of finalization rounds,
15 * "is a family of pseudorandom functions optimized for speed on short
18 * Implemented from the paper https://131002.net/siphash/
19 * The designers recommend using SipHash-2-4 or SipHash-4-8
21 * SipHash-c-d uses a 16-byte key.
22 * To defend against hash-flooding, the application needs to use
23 * a new random key regularly.
25 * The designers of SipHash claim it is cryptographically strong
26 * to use as MAC with secret key but _not_collision_resistant_.
28 * Returns one 64-bit word as the hash function result.
31 * // Outputs cf2794e0277187b7
33 * #include <ccan/siphash/siphash.h>
37 * unsigned char t_key[16] =
38 * {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
39 * unsigned char data[4] = "\0\1\2\3";
40 * uint64_t hash = siphash_2_4(data, sizeof(data), t_key);
41 * printf("%llx\n", (unsigned long long)hash);
47 uint64_t siphash_2_4(const void *in, size_t len, const unsigned char key[16]);
49 #endif /* CCAN_SIPHASH_H_ */