diff options
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; +} |