For SHA_256, I am not getting correct output. #23969
-
Hi, #include <stdio.h> OSSL_LIB_CTX *libctx = NULL; int sha_256()
// initialise the MD to use sha256
} int main(int argc, char **argv) output : Excpected output is: ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
The |
Beta Was this translation helpful? Give feedback.
-
sorry, I didn't get what you're asking. I am passing the length of the array to EVP_DigestUpdate(ctx, str, length); |
Beta Was this translation helpful? Give feedback.
-
@t8m is correct, sizeof(str) returns 4 (as it includes the NULL terminator on the char array, whereas strlen(str) would return 3. If you run this code replacing sizeof(str) with strlen(str), the expected sha256 output is produced |
Beta Was this translation helpful? Give feedback.
@t8m is correct, sizeof(str) returns 4 (as it includes the NULL terminator on the char array, whereas strlen(str) would return 3. If you run this code replacing sizeof(str) with strlen(str), the expected sha256 output is produced