X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Fcrypto%2Fsha512%2F_info;fp=ccan%2Fcrypto%2Fsha512%2F_info;h=aabfad2513bf084fc91b5b3bd7317774660ba715;hb=5e37a0febfb89a2535f2eb9f0ea06a5546a39234;hp=0000000000000000000000000000000000000000;hpb=c3a4f74f5ddedd7fed3f351498a6743d2a1d9ed1;p=ccan diff --git a/ccan/crypto/sha512/_info b/ccan/crypto/sha512/_info new file mode 100644 index 00000000..aabfad25 --- /dev/null +++ b/ccan/crypto/sha512/_info @@ -0,0 +1,61 @@ +#include "config.h" +#include +#include + +/** + * crypto/sha512 - implementation of SHA-2 with 512 bit digest. + * + * This code is either a wrapper for openssl (if CCAN_CRYPTO_SHA512_USE_OPENSSL + * is defined) or an open-coded implementation based on Bitcoin's. + * + * License: BSD-MIT + * Maintainer: Rusty Russell + * + * Example: + * #include + * #include + * #include + * #include + * + * // Simple demonstration: identical strings will have the same hash, but + * // two different strings will not. + * int main(int argc, char *argv[]) + * { + * struct sha512 hash1, hash2; + * + * if (argc != 3) + * errx(1, "Usage: %s ", argv[0]); + * + * sha512(&hash1, argv[1], strlen(argv[1])); + * sha512(&hash2, 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/compiler\n"); + printf("ccan/endian\n"); + return 0; + } + + if (strcmp(argv[1], "testdepends") == 0) { + printf("ccan/str/hex\n"); + return 0; + } + + if (strcmp(argv[1], "libs") == 0) { +#ifdef CCAN_CRYPTO_SHA512_USE_OPENSSL + printf("crypto\n"); +#endif + return 0; + } + + return 1; +}