mirror of
https://github.com/cathugger/mkp224o.git
synced 2025-01-09 19:17:19 -03:00
a bit of calcest and some other stuff
This commit is contained in:
parent
e12a3eb7c9
commit
eea863e3ac
3 changed files with 9 additions and 5 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,5 +1,7 @@
|
||||||
# output files
|
# output files
|
||||||
mkp224o
|
mkp224o
|
||||||
|
calcest
|
||||||
|
test_*
|
||||||
*.o
|
*.o
|
||||||
|
|
||||||
# generated onions
|
# generated onions
|
||||||
|
|
|
@ -57,6 +57,7 @@ TEST_ED25519_OBJ= \
|
||||||
|
|
||||||
ALL_O= $(sort \
|
ALL_O= $(sort \
|
||||||
$(MAIN_OBJ) \
|
$(MAIN_OBJ) \
|
||||||
|
$(UTIL_CALCEST_OBJ) \
|
||||||
$(TEST_BASE64_OBJ) \
|
$(TEST_BASE64_OBJ) \
|
||||||
$(TEST_BASE32_OBJ) \
|
$(TEST_BASE32_OBJ) \
|
||||||
$(TEST_BASE16_OBJ) \
|
$(TEST_BASE16_OBJ) \
|
||||||
|
|
11
calcest.c
11
calcest.c
|
@ -15,19 +15,20 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const double probs[] = { 0.5, 0.8, 0.9, 0.95, 0.99 };
|
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(" |");
|
printf(" |");
|
||||||
for (size_t i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) {
|
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("\n");
|
||||||
|
|
||||||
printf("---+");
|
printf("---+");
|
||||||
for (size_t i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) {
|
for (size_t i = 0; i < sizeof(probs)/sizeof(probs[0]); ++i) {
|
||||||
printf("--------------+");
|
printf("------------------+");
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ int main(void)
|
||||||
printf("%2d |",charcounts[i]);
|
printf("%2d |",charcounts[i]);
|
||||||
for (size_t j = 0; j < sizeof(probs)/sizeof(probs[0]); ++j) {
|
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])));
|
double t = log2(1 - probs[j]) / log2(1 - (1 / pow(32,charcounts[i])));
|
||||||
printf(" %12.0f |",t);
|
printf(" %16.0f |",t);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue