diff --git a/.gitignore b/.gitignore index 01a1447..4d8142e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ # output files mkp224o +calcest +test_* *.o # generated onions diff --git a/GNUmakefile.in b/GNUmakefile.in index 71beef6..d566837 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -57,6 +57,7 @@ TEST_ED25519_OBJ= \ ALL_O= $(sort \ $(MAIN_OBJ) \ + $(UTIL_CALCEST_OBJ) \ $(TEST_BASE64_OBJ) \ $(TEST_BASE32_OBJ) \ $(TEST_BASE16_OBJ) \ diff --git a/calcest.c b/calcest.c index 28d9c98..0315a3a 100644 --- a/calcest.c +++ b/calcest.c @@ -15,19 +15,20 @@ */ const double probs[] = { 0.5, 0.8, 0.9, 0.95, 0.99 }; -const int charcounts[] = { 2, 3, 4, 5, 6, 7 }; +const int charcounts[] = { 2, 3, 4, 5, 6, 7, 8, 9, 10 }; -int main(void) +int main(int argc,char **argv) { + printf(" |"); for (size_t i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) { - printf(" %11d%% |",(int)((probs[i]*100)+0.5)); + printf(" %15d%% |",(int)((probs[i]*100)+0.5)); } printf("\n"); printf("---+"); for (size_t i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) { - printf("--------------+"); + printf("------------------+"); } printf("\n"); @@ -35,7 +36,7 @@ int main(void) printf("%2d |",charcounts[i]); for (size_t j = 0; j < sizeof(probs)/sizeof(probs[0]); ++j) { double t = log2(1 - probs[j]) / log2(1 - (1 / pow(32,charcounts[i]))); - printf(" %12.0f |",t); + printf(" %16.0f |",t); } printf("\n"); }