// CURRENTLY BROKEN, needs to be remade for new ESPReader structure #include "msh.h" #include "ESPReader.h" #undef NDEBUG #include #include #include #include #include #define BITS 9 #define NUM 512 #define PER_LINE 4 bool buf[NUM]; int main() { uint32_t seed = 1; bool clash; size_t max = 0; do { if ((seed - 1) % 1000000 == 0) printf("Checked up to: %u\r", seed - 1); // reset for test memset(buf, 0, sizeof(bool) * NUM); clash = false; // check for collisions for (size_t i = 0; i != RT_SIZE; i++) { uint32_t index = uint32_t_msh(rt[i], BITS, seed); if (buf[index]) { if (i > max) { // printf("\nMax: %llu\n", i); max = i; } clash = true; break; } else { buf[index] = true; } } // exit if non-clashing seed found if (!clash) { break; } // seed must be odd seed += 2; } while (seed != UINT32_MAX); // is odd, so will be hit if (!clash) { printf("\nSeed found: %u", seed); for (size_t i = 0; i != RT_SIZE; i++) { char name[5]; memcpy(name, &rt[i], sizeof(uint32_t)); name[4] = '\0'; uint32_t index = uint32_t_msh(rt[i], BITS, seed); if (i % PER_LINE == 0) printf("\n"); else printf(" "); printf("RT_%s = %3u,", name, index); } } else { printf("Seed not found. Max: %llu\n", max); } return 0; }