RosettaCodeData/Task/SHA-256/C/sha-256.c

16 lines
284 B
C
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
#include <stdio.h>
#include <string.h>
#include <openssl/sha.h>
int main (void) {
2025-08-11 18:05:26 -07:00
const char *s = "Rosetta code";
unsigned char *d = SHA256(s, strlen(s), 0);
2023-07-01 11:58:00 -04:00
2025-08-11 18:05:26 -07:00
int i;
for (i = 0; i < SHA256_DIGEST_LENGTH; i++)
printf("%02x", d[i]);
putchar('\n');
2023-07-01 11:58:00 -04:00
2025-08-11 18:05:26 -07:00
return 0;
2023-07-01 11:58:00 -04:00
}