1 (edited by rkroshan.1997 2020-10-13 06:10:50)

Topic: Different Sha256 getting from wolfssl and openssl

Hi,

I am trying to get sha256 hash of a message "This is the message" using wolfssl library function wc_Sha256Hash() and compared it with an online sha generator result. I am getting both hashes different.

From wc_Sha256Hash() function I got this hash "yO1eZXE/gXC40HaajtjDV0C6C3BtWFbiLXCb4eABz4w=" (after base64 encoding)
From online Sha generator I got this hash "c8ed5e65713f8170b8d0769a8ed8c35740ba0b706d5856e22d709be1e001cf8c"

Why both are different ? Am I missing something ?

Share

Re: Different Sha256 getting from wolfssl and openssl

Easy to make the mistake, the latter is hex and not base64 encoded. There are hex to base64 online (first one I found was https://base64.guru/converter/encode/hex). Putting `c8ed5e65713f8170b8d0769a8ed8c35740ba0b706d5856e22d709be1e001cf8c` in it generated the same base64 that you posted (`yO1eZXE/gXC40HaajtjDV0C6C3BtWFbiLXCb4eABz4w=`).

Hope that helps.

Share

Re: Different Sha256 getting from wolfssl and openssl

Yes, you are right. Thanks Jeff for the help  smile

Share