6 * crypto/hmac_sha256 - RFC2104 HMAC using SHA256.
8 * This code implements RFC2104, which is a fairly standard HMAC.
11 * Maintainer: Rusty Russell <rusty@rustcorp.com.au>
14 * #include <ccan/crypto/hmac_sha256/hmac_sha256.h>
19 * // Simple demonstration: idential strings will have the same hash, but
20 * // two different strings will not.
21 * int main(int argc, char *argv[])
23 * struct hmac_sha256 hash1, hash2;
26 * errx(1, "Usage: %s <string1> <string2>", argv[0]);
28 * hmac_sha256(&hash1, "key", 3, argv[1], strlen(argv[1]));
29 * hmac_sha256(&hash2, "key", 3, argv[2], strlen(argv[2]));
30 * printf("Hash is %s\n", memcmp(&hash1, &hash2, sizeof(hash1))
31 * ? "different" : "same");
35 int main(int argc, char *argv[])
37 /* Expect exactly one argument */
41 if (strcmp(argv[1], "depends") == 0) {
42 printf("ccan/crypto/sha256\n");
46 if (strcmp(argv[1], "testdepends") == 0) {
47 printf("ccan/str/hex\n");