From b1089d91ec8a7acef32ab588917680e77862617e Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Tue, 16 Jul 2019 11:47:57 -0400 Subject: initial commit --- main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 main.c (limited to 'main.c') diff --git a/main.c b/main.c new file mode 100644 index 0000000..5ef63fc --- /dev/null +++ b/main.c @@ -0,0 +1,20 @@ +#include // printf() +#include // strlen() +#include "sha256.h" + +static const char DEFAULT[] = "The quick brown fox jumps over the lazy dog"; + +int main(int argc, char *argv[]) { + const char *src = (argc > 1) ? argv[1] : DEFAULT; + uint8_t dst[SHA256_HASH_SIZE]; + + sha256((const uint8_t *) src, strlen(src), dst); + + printf("src = \"%s\"\nhash = \"", src); + for (size_t i = 0; i < 32; i++) { + printf("%02x", dst[i]); + } + printf("\"\n"); + + return 0; +} -- cgit v1.2.3