diff options
author | Paul Duncan <pabs@pablotron.org> | 2019-07-16 11:47:57 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2019-07-16 11:47:57 -0400 |
commit | b1089d91ec8a7acef32ab588917680e77862617e (patch) | |
tree | ca7d6ed5997bb8cd33571cc9b80f10a6a3849874 /main.c | |
download | sha2-b1089d91ec8a7acef32ab588917680e77862617e.tar.bz2 sha2-b1089d91ec8a7acef32ab588917680e77862617e.zip |
initial commit
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -0,0 +1,20 @@ +#include <stdio.h> // printf() +#include <string.h> // 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; +} |