X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fsiphash%2F_info;fp=ccan%2Fsiphash%2F_info;h=e6d518aa40bf533edbfadfa9819ee28a3a494672;hp=0000000000000000000000000000000000000000;hb=480b3117c39b91fcb6d39c60222232b7608f5507;hpb=6bab11a210f123033225553057e24e68b99a8afd diff --git a/ccan/siphash/_info b/ccan/siphash/_info new file mode 100644 index 00000000..e6d518aa --- /dev/null +++ b/ccan/siphash/_info @@ -0,0 +1,55 @@ +#include +#include +#include "config.h" + +/** + * siphash - a keyed hash function + * + * SipHash-c-d, where `c` is the number of rounds per message chunk + * and `d` the number of finalization rounds, + * "is a family of pseudorandom functions optimized for speed on short + * messages" + * + * Implemented from the paper https://131002.net/siphash/ + * The designers recommend using SipHash-2-4 or SipHash-4-8 + * + * SipHash-c-d uses a 16-byte key. + * To defend against hash-flooding, the application needs to use + * a new random key regularly. + * + * The designers of SipHash claim it is cryptographically strong + * to use as MAC with secret key but _not_collision_resistant_. + * + * Returns one 64-bit word as the hash function result. + * + * Example: + * // Outputs "cf2794e0277187b7" + * #include + * #include + * + * int main(void) + * { + * unsigned char t_key[16] = + * {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; + * unsigned char data[4] = "\0\1\2\3"; + * uint64_t hash = siphash_2_4(data, sizeof(data), t_key); + * printf("%llx\n", (unsigned long long)hash); + * + * return 0; + * } + * + * + * License: GPL (v2 or any later version) + */ +int main(int argc, char *argv[]) +{ + if (argc != 2) + return 1; + + if (strcmp(argv[1], "depends") == 0) { + printf("ccan/endian\n"); + return 0; + } + + return 1; +}