6 * siphash - a keyed hash function
8 * SipHash-c-d, where `c` is the number of rounds per message chunk
9 * and `d` the number of finalization rounds,
10 * "is a family of pseudorandom functions optimized for speed on short
13 * Implemented from the paper https://131002.net/siphash/
14 * The designers recommend using SipHash-2-4 or SipHash-4-8
16 * SipHash-c-d uses a 16-byte key.
17 * To defend against hash-flooding, the application needs to use
18 * a new random key regularly.
20 * The designers of SipHash claim it is cryptographically strong
21 * to use as MAC with secret key but _not_collision_resistant_.
23 * Returns one 64-bit word as the hash function result.
26 * // Outputs cf2794e0277187b7
28 * #include <ccan/siphash/siphash.h>
32 * unsigned char t_key[16] =
33 * {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
34 * unsigned char data[4] = "\0\1\2\3";
35 * uint64_t hash = siphash_2_4(data, sizeof(data), t_key);
36 * printf("%llx\n", (unsigned long long)hash);
42 * License: GPL (v2 or any later version)
44 int main(int argc, char *argv[])
49 if (strcmp(argv[1], "depends") == 0) {
50 printf("ccan/endian\n");