Arm Mbed and Pelion Device Management support forum

Produced hashing vaule not reproducable


I am currently using the mbedtls library for sha-256 hashing. therefore I use the function mbedtls_sha256_ret as follows:

void hashData(unsigned char *hashInput, size_t hashLength, unsigned char *hashOutput){
returnValue = mbedtls_sha256_ret( (unsigned char *) hashInput, hashLength, hashOutput, 0 );

The function ends without an error and the return (printed in a hexadecimal format) looks vaild. However, when I try to recreate the hash with other softwares, the outputs do not match.

Is there a salt added somewhere during the hashing process? Or is there another explanation?

Hi @svrtas
As mentioned in this poast, Mbed TLS is now maintained under open governance at and you should post your questions in their mailing list.

Looking at your code, I don’t see anything out of the ordinary, but there is not enough information. Have you tested with known test vectors?

Mbed support