- for (size_t i = 0; i < UINT8_MAX+1; i++)
- {
- int complete = 0;
- for (size_t j = 0; j < BYTE_LEN; j++)
- {
- for (size_t k = 0; k < BYTE_LEN; k++)
- {
- if (g_mixed[i][k] == g_ordered[j])
- {
- complete++;
- }
- }
- }
- if (complete != BYTE_LEN)
- {
- crit_exit("FATAL: Table verification has failed!");
- }
- for (size_t j = 0; j < UINT8_MAX+1; j++)
- {
- uint8_t a[BYTE_LEN], b[BYTE_LEN];
- if (i == j)
- {
- continue;
- }
- memcpy(a, g_ordered, sizeof(uint8_t) * BYTE_LEN);
- memcpy(b, g_ordered, sizeof(uint8_t) * BYTE_LEN);
- apply_permutation(&g_table[i][0], a);
- apply_permutation(&g_table[j][0], b);
- const uint32_t dist = compute_distance(a, b);
- if ((dist > DISTANCE_MAX) || (dist < DISTANCE_MIN))
- {
- crit_exit("FATAL: Table verification has failed!");
- }
- }
- }
- for (size_t i = 0; i < BYTE_LEN; i++)
- {
- if (g_ordered[i] != (uint8_t)(i))
- {
- crit_exit("FATAL: Ordering verification has failed!");
- }
- }
-
- SEM_DESTROY(&stop_flag);
- MUTEX_DESTROY(&stop_mutex);
-