<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC MicrocontrollersのトピックRe: Wrong SHA256 hash value from hashcrypt</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Wrong-SHA256-hash-value-from-hashcrypt/m-p/1743464#M54500</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/27788"&gt;@Alice_Yang&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there a difference according this problem between v2.13.0 and v.2.14.0. ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TestNXP_0-1697785079343.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/246085i4A9C3DDD10D82D0D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TestNXP_0-1697785079343.png" alt="TestNXP_0-1697785079343.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can you tell me where this limitation comes from? From my understanding hashing should be possible for as big data as you want.&lt;/P&gt;</description>
    <pubDate>Fri, 20 Oct 2023 07:01:24 GMT</pubDate>
    <dc:creator>TestNXP</dc:creator>
    <dc:date>2023-10-20T07:01:24Z</dc:date>
    <item>
      <title>Wrong SHA256 hash value from hashcrypt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Wrong-SHA256-hash-value-from-hashcrypt/m-p/1741419#M54459</link>
      <description>&lt;DIV&gt;Hello,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;when I am calculating a SHA256 hash via hashcrypt functions for messages longer than 120000 Bytes I get wrong hash results (see screenshot). You can see the python results on the left and the NXP MCU calculated values on the right.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 827px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/245549i498C059E82BC9E8D/image-dimensions/827x69?v=v2" width="827" height="69" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;P&gt; &lt;/P&gt;&lt;BR /&gt;&lt;SPAN&gt;I am caluclating the hash for byte arrays filled with "0xAB".&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;Is there some limitation to the message size that can be hashed by the hashcrypt periphery?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am using a LPC55S28 MCU. I am testing this with following function based on the hashcrypt example:&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;void TestSha256(void)
{
static uint8_t message[MESSAGE_SIZE];

for (int i = 0; i &amp;lt; 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(&amp;amp;output, 0, outLength);

    /************************ SHA-256 **************************/
    status = HASHCRYPT_SHA(HASHCRYPT, kHASHCRYPT_Sha256, message, 100000, output, &amp;amp;outLength);
    TEST_ASSERT(kStatus_Success == status);
    TEST_ASSERT(outLength == 32u);
    PRINTF("100kiB: ");
    for (int i = 0; i &amp;lt; 32; i++)
    {
    PRINTF("%x", output[i]);
    }
    PRINTF("\n");
    status = HASHCRYPT_SHA(HASHCRYPT, kHASHCRYPT_Sha256, message, 120000, output, &amp;amp;outLength);
    TEST_ASSERT(kStatus_Success == status);
    TEST_ASSERT(outLength == 32u);
    PRINTF("120kiB: ");
    for (int i = 0; i &amp;lt; 32; i++)
    {
    PRINTF("%x", output[i]);
    }
    PRINTF("\n");
    status = HASHCRYPT_SHA(HASHCRYPT, kHASHCRYPT_Sha256, message, 130000, output, &amp;amp;outLength);
    TEST_ASSERT(kStatus_Success == status);
    TEST_ASSERT(outLength == 32u);
    PRINTF("130kiB: ");
    for (int i = 0; i &amp;lt; 32; i++)
    {
    PRINTF("%x", output[i]);
    }
    PRINTF("\n");
    status = HASHCRYPT_SHA(HASHCRYPT, kHASHCRYPT_Sha256, message, 140000, output, &amp;amp;outLength);
    TEST_ASSERT(kStatus_Success == status);
    TEST_ASSERT(outLength == 32u);
    PRINTF("140kiB: ");
    for (int i = 0; i &amp;lt; 32; i++)
    {
    PRINTF("%x", output[i]);
    }
    PRINTF("\n");
    status = HASHCRYPT_SHA(HASHCRYPT, kHASHCRYPT_Sha256, message, 150000, output, &amp;amp;outLength);
    TEST_ASSERT(kStatus_Success == status);
    TEST_ASSERT(outLength == 32u);
    PRINTF("150kiB: ");
    for (int i = 0; i &amp;lt; 32; i++)
    {
    PRINTF("%x", output[i]);
    }
    PRINTF("\n");
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 15:17:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Wrong-SHA256-hash-value-from-hashcrypt/m-p/1741419#M54459</guid>
      <dc:creator>TestNXP</dc:creator>
      <dc:date>2023-10-17T15:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong SHA256 hash value from hashcrypt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Wrong-SHA256-hash-value-from-hashcrypt/m-p/1741974#M54472</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/219866"&gt;@TestNXP&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please use latest&amp;nbsp; version SDK v2.14.0.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BR&lt;/P&gt;
&lt;P&gt;Alice&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 08:53:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Wrong-SHA256-hash-value-from-hashcrypt/m-p/1741974#M54472</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2023-10-18T08:53:07Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong SHA256 hash value from hashcrypt</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Wrong-SHA256-hash-value-from-hashcrypt/m-p/1743464#M54500</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/27788"&gt;@Alice_Yang&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there a difference according this problem between v2.13.0 and v.2.14.0. ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TestNXP_0-1697785079343.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/246085i4A9C3DDD10D82D0D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="TestNXP_0-1697785079343.png" alt="TestNXP_0-1697785079343.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Can you tell me where this limitation comes from? From my understanding hashing should be possible for as big data as you want.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Oct 2023 07:01:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Wrong-SHA256-hash-value-from-hashcrypt/m-p/1743464#M54500</guid>
      <dc:creator>TestNXP</dc:creator>
      <dc:date>2023-10-20T07:01:24Z</dc:date>
    </item>
  </channel>
</rss>

