blob: 5ef63fc12faaac90d507745fa5fd8a4a9b64a817 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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;
}
|