I am trying to program SHA256 implementation from this website: http://bradconte.com/sha256_c in a MSP430f5529 MCU board in Energia IDE.
This is the testcode:
unsigned char hash[32]; SHA256_CTX ctx; sha256_init(&ctx); sha256_update(&ctx,(unsigned char*)"abc",4); sha256_final(&ctx,hash); PrintHex(hash);
This function converts the input to hex
void PrintHex(unsigned char * data)
{
char tmp[16];
for (int i=0; i<32; i++) {
sprintf(tmp, "%02x",data[i]);
Serial.print(tmp);
}
}
The problem is that the output is always a wrong hash code. I tried this algorithm on my desktop and there it works. Is the implementation not compatible for this board or something? I tried to find other implementations but didn't work out in Energia.