void TestSha256(void)
{
static uint8_t message[MESSAGE_SIZE];
for (int i = 0; i < MESSAGE_SIZE; i++)
{
message[i] = 0xab;
}
status_t status;
size_t outLength;
unsigned int length;
unsigned char output[32];
length = sizeof(message);
outLength = sizeof(output);
memset(&output, 0, outLength);
/************************ SHA-256 **************************/
status = HASHCRYPT_SHA(HASHCRYPT, kHASHCRYPT_Sha256, message, 100000, output, &outLength);
TEST_ASSERT(kStatus_Success == status);
TEST_ASSERT(outLength == 32u);
PRINTF("100kiB: ");
for (int i = 0; i < 32; i++)
{
PRINTF("%x", output[i]);
}
PRINTF("\n");
status = HASHCRYPT_SHA(HASHCRYPT, kHASHCRYPT_Sha256, message, 120000, output, &outLength);
TEST_ASSERT(kStatus_Success == status);
TEST_ASSERT(outLength == 32u);
PRINTF("120kiB: ");
for (int i = 0; i < 32; i++)
{
PRINTF("%x", output[i]);
}
PRINTF("\n");
status = HASHCRYPT_SHA(HASHCRYPT, kHASHCRYPT_Sha256, message, 130000, output, &outLength);
TEST_ASSERT(kStatus_Success == status);
TEST_ASSERT(outLength == 32u);
PRINTF("130kiB: ");
for (int i = 0; i < 32; i++)
{
PRINTF("%x", output[i]);
}
PRINTF("\n");
status = HASHCRYPT_SHA(HASHCRYPT, kHASHCRYPT_Sha256, message, 140000, output, &outLength);
TEST_ASSERT(kStatus_Success == status);
TEST_ASSERT(outLength == 32u);
PRINTF("140kiB: ");
for (int i = 0; i < 32; i++)
{
PRINTF("%x", output[i]);
}
PRINTF("\n");
status = HASHCRYPT_SHA(HASHCRYPT, kHASHCRYPT_Sha256, message, 150000, output, &outLength);
TEST_ASSERT(kStatus_Success == status);
TEST_ASSERT(outLength == 32u);
PRINTF("150kiB: ");
for (int i = 0; i < 32; i++)
{
PRINTF("%x", output[i]);
}
PRINTF("\n");
}
Solved! Go to Solution.
Hello @Alice_Yang
is there a difference according this problem between v2.13.0 and v.2.14.0. ?
I did also get the information that hardware hashing is limited to 2047 blocks each 512 Bit which does indeed result to ~130000 Bytes. Thats also the point where hashcrypt generates wrong hash values for me. (See screenshot from LPC55xx user guide)
Can you tell me where this limitation comes from? From my understanding hashing should be possible for as big data as you want.
Hello @Alice_Yang
is there a difference according this problem between v2.13.0 and v.2.14.0. ?
I did also get the information that hardware hashing is limited to 2047 blocks each 512 Bit which does indeed result to ~130000 Bytes. Thats also the point where hashcrypt generates wrong hash values for me. (See screenshot from LPC55xx user guide)
Can you tell me where this limitation comes from? From my understanding hashing should be possible for as big data as you want.