X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fcrypto%2Fhmac_sha256%2F_info;fp=ccan%2Fcrypto%2Fhmac_sha256%2F_info;h=386123872eda4876af8775de8b7133d508d14ce9;hb=d32033ada4a4e5821baef20958ae6de0b54622b2;hp=0000000000000000000000000000000000000000;hpb=346058c002415e57c6ed36efcfacb6813150aaa7;p=ccan diff --git a/ccan/crypto/hmac_sha256/_info b/ccan/crypto/hmac_sha256/_info new file mode 100644 index 00000000..38612387 --- /dev/null +++ b/ccan/crypto/hmac_sha256/_info @@ -0,0 +1,52 @@ +#include "config.h" +#include +#include + +/** + * crypto/hmac_sha256 - RFC2104 HMAC using SHA256. + * + * This code implements RFC2104, which is a fairly standard HMAC. + * + * License: BSD-MIT + * Maintainer: Rusty Russell + * + * Example: + * #include + * #include + * #include + * #include + * + * // Simple demonstration: idential strings will have the same hash, but + * // two different strings will not. + * int main(int argc, char *argv[]) + * { + * struct hmac_sha256 hash1, hash2; + * + * if (argc != 3) + * errx(1, "Usage: %s ", argv[0]); + * + * hmac_sha256(&hash1, "key", 3, argv[1], strlen(argv[1])); + * hmac_sha256(&hash2, "key", 3, argv[2], strlen(argv[2])); + * printf("Hash is %s\n", memcmp(&hash1, &hash2, sizeof(hash1)) + * ? "different" : "same"); + * return 0; + * } + */ +int main(int argc, char *argv[]) +{ + /* Expect exactly one argument */ + if (argc != 2) + return 1; + + if (strcmp(argv[1], "depends") == 0) { + printf("ccan/crypto/sha256\n"); + return 0; + } + + if (strcmp(argv[1], "testdepends") == 0) { + printf("ccan/str/hex\n"); + return 0; + } + + return 1; +}