a bit of calcest and some other stuff

This commit is contained in:
cathugger 2021-11-03 00:20:43 +00:00
parent e12a3eb7c9
commit eea863e3ac
No known key found for this signature in database
GPG key ID: 9BADDA2DAF6F01A8
3 changed files with 9 additions and 5 deletions

2
.gitignore vendored
View file

@ -1,5 +1,7 @@
# output files
mkp224o
calcest
test_*
*.o
# generated onions

View file

@ -57,6 +57,7 @@ TEST_ED25519_OBJ= \
ALL_O= $(sort \
$(MAIN_OBJ) \
$(UTIL_CALCEST_OBJ) \
$(TEST_BASE64_OBJ) \
$(TEST_BASE32_OBJ) \
$(TEST_BASE16_OBJ) \

View file

@ -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");
}