Skip to content

For SHA_256, I am not getting correct output. #23969

Closed Answered by nhorman
rdiwan2023 asked this question in Q&A
Discussion options

You must be logged in to vote

@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

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@t8m
Comment options

Comment options

You must be logged in to vote
1 reply
@rdiwan2023
Comment options

Answer selected by nhorman
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants