OSDN Git Service

Small improvement to self-test.
authorLoRd_MuldeR <mulder2@gmx.de>
Sun, 24 Dec 2017 15:17:34 +0000 (16:17 +0100)
committerLoRd_MuldeR <mulder2@gmx.de>
Sun, 24 Dec 2017 15:17:34 +0000 (16:17 +0100)
include/mhash_384.h
src/self_test.h

index e81c7cf..432d179 100644 (file)
@@ -64,7 +64,7 @@ namespace internals {
 
 /*Version*/
 static const uint_fast16_t MHASH_384_VERSION_MAJOR = UINT32_C(1);
-static const uint_fast16_t MHASH_384_VERSION_MINOR = UINT32_C(1);
+static const uint_fast16_t MHASH_384_VERSION_MINOR = UINT32_C(2);
 static const uint_fast16_t MHASH_384_VERSION_PATCH = UINT32_C(0);
 
 /*Hash length definition*/
index 9769425..600e620 100644 (file)
@@ -168,6 +168,22 @@ static int self_test(void)
        fprintf(stderr, "Self-test, step 3 of 4 running...\n");
        for (i = 0U; i < 256U; i++)
        {
+               for (j = 0U; j < MHASH_384_LEN; j++)
+               {
+                       int found = 0;
+                       for (k = 0U; k < MHASH_384_LEN; k++)
+                       {
+                               if (MHASH_384_TABLE_MIX[i][k] == (uint8_t)j)
+                               {
+                                       MY_ASSERT((!found), "MIX table verification failed");
+                                       found = 1;
+                               }
+                       }
+                       MY_ASSERT(found, "MIX table verification failed");
+               }
+       }
+       for (i = 0U; i < 256U; i++)
+       {
                for (j = 0U; j < 256U; j++)
                {
                        const uint32_t distance = test_distance_mix(&MHASH_384_TABLE_MIX[i][0], &MHASH_384_TABLE_MIX[j][0]);