6 * crypto/sha256 - implementation of SHA-2 with 256 bit digest.
8 * This code is either a wrapper for openssl (if CCAN_CRYPTO_SHA256_USE_OPENSSL
9 * is defined) or an open-coded implementation based on Bitcoin's.
12 * Maintainer: Rusty Russell <rusty@rustcorp.com.au>
15 * #include <ccan/crypto/sha256/sha256.h>
20 * // Simple demonstration: idential strings will have the same hash, but
21 * // two different strings will not.
22 * int main(int argc, char *argv[])
24 * struct sha256 hash1, hash2;
27 * errx(1, "Usage: %s <string1> <string2>", argv[0]);
29 * sha256(&hash1, argv[1], strlen(argv[1]));
30 * sha256(&hash2, argv[2], strlen(argv[2]));
31 * printf("Hash is %s\n", memcmp(&hash1, &hash2, sizeof(hash1))
32 * ? "different" : "same");
36 int main(int argc, char *argv[])
38 /* Expect exactly one argument */
42 if (strcmp(argv[1], "depends") == 0) {
43 printf("ccan/compiler\n");
44 printf("ccan/endian\n");
48 if (strcmp(argv[1], "testdepends") == 0) {
49 printf("ccan/str/hex\n");
53 if (strcmp(argv[1], "libs") == 0) {
54 #ifdef CCAN_CRYPTO_SHA256_USE_OPENSSL