Question
STM32F756 MD5 hash wrong result
I'm using the hardware hash processor of an STM32F756 to calculate the MD5 of string "user:realm:password", but the result is wrong. I'm using the HAL library, this is my code.
static void AuthRespCalc(char * username, char *realm, char * password)
{
uint8_t hash[16];
/* HA1 -> HA1=MD5(username:realm:password) */
HASH_Init();
HAL_HASH_MD5_Accumulate(&hhash, (uint8_t *) username, strlen(username));
HAL_HASH_MD5_Accumulate(&hhash, (uint8_t *) ":", 1);
HAL_HASH_MD5_Accumulate(&hhash, (uint8_t *) realm, strlen(realm));
HAL_HASH_MD5_Accumulate(&hhash, (uint8_t *) ":", 1);
HAL_HASH_MD5_Start(&hhash, (uint8_t *) password, strlen(password), hash, 0xFF);
HAL_HASH_DeInit(&hhash);
}I'm doing something wrong? Has anyone faced the same problem?
Thanks for any help.
