6 * crypto/siphash24 - implementation of SipHash-2-4.
8 * SipHash was designed as a mitigation to hash-flooding DoS
9 * attacks. It is now used in the hash tables implementation of
10 * Python, Ruby, Perl 5, etc.
12 * SipHash was designed by Jean-Philippe Aumasson and Daniel J. Bernstein.
15 * Maintainer: Rusty Russell <rusty@rustcorp.com.au>
18 * // Dumb example to print siphash of words, and all strung together.
19 * #include <ccan/crypto/siphash24/siphash24.h>
23 * #include <inttypes.h>
25 * int main(int argc, char *argv[])
27 * struct siphash_seed seed;
28 * struct siphash24_ctx ctx;
32 * fprintf(stderr, "Need at least seed1 and seed2 arguments");
36 * seed.u.u64[0] = atoi(argv[1]);
37 * seed.u.u64[1] = atoi(argv[2]);
38 * siphash24_init(&ctx, &seed);
39 * for (i = 3; i < argc; i++) {
40 * printf("Hash of '%s' = %"PRIu64,
41 * argv[i], siphash24(&seed, argv[i], strlen(argv[i])));
42 * siphash24_update(&ctx, argv[i], strlen(argv[i]));
44 * printf("Hash of concatenated args = %"PRIu64, siphash24_done(&ctx));
48 int main(int argc, char *argv[])
50 /* Expect exactly one argument */
54 if (strcmp(argv[1], "depends") == 0) {
55 printf("ccan/endian\n");