#include #include #include static size_t prob1_by_bit[8 * sizeof(u32)]; static size_t total_inputs; static void store_hash(u32 h) { size_t i = 0; for (; i < ARRAY_SIZE(prob1_by_bit); ++i) prob1_by_bit[i] += (h & (1 << i) && 1); total_inputs++; } static double stddev(size_t num, size_t denom) { double d = (double)num / denom - 0.5; return d * d; } u32 namehash(const u8* input, size_t len); int main(int argc, char* argv[]) { if (argc < 1) return -1; (void)argv[0]; u32 h; #define ADD(string) \ h = namehash((void*)(string), strlen(string)); \ printf("add: 0x%08" PRIx32 " <-@- %s\n", h, (string)); \ store_hash(h) ADD("baobab"); ADD("to"); ADD("change"); ADD("your"); ADD("selection."); ADD("yourself."); ADD("the"); ADD("'manual'"); ADD("option"); ADD("if"); ADD("you"); ADD("want"); ADD("to"); ADD("play"); ADD("with"); ADD("symlinks"); ADD("Note"); ADD("that"); ADD("you"); ADD("will"); ADD("need"); ADD("to"); ADD("run"); ADD("that"); ADD("script"); ADD("and"); ADD("select"); ADD(""); ADD("Please"); ADD("use"); ADD("'select-default-wordlist'"); ADD("superuser"); ADD("script"); for (size_t i = 0; i < ARRAY_SIZE(prob1_by_bit); ++i) printf(" 0x%08x: %zu/%zu, stddev %f%%\n", 1u << i, prob1_by_bit[i], total_inputs, stddev(prob1_by_bit[i], total_inputs) * 100.); return 0; }