]> git.ipfire.org Git - thirdparty/nettle.git/blob - eccparams.c
Add ChangeLog entry for nettle-3.10 release.
[thirdparty/nettle.git] / eccparams.c
1 #include <stdio.h>
2 #include <stdlib.h>
3
4 int
5 main (int argc, char **argv)
6 {
7 unsigned bits;
8 unsigned max;
9 unsigned c;
10 if (argc < 3)
11 {
12 usage:
13 fprintf(stderr, "Usage: %s: exp-bits max-entries\n", argv[0]);
14 return EXIT_FAILURE;
15 }
16 bits = atoi(argv[1]);
17 if (bits < 2)
18 goto usage;
19 max = atoi(argv[2]);
20 if ( max < 2)
21 goto usage;
22
23 for (c = 3; (1<<c) <= max; c++)
24 {
25 unsigned b;
26 for (b = 1;; b++)
27 {
28 unsigned s = (1<<c) * b;
29 unsigned k;
30 if (s > max)
31 break;
32 k = (bits + (c*b) - 1) / (c * b);
33 printf("k = %2u, c = %2u, S = %3u, T = %3u (%3u A + %2u D)\n",
34 k, c, s, (b+1)*k, b*k, k);
35 }
36 }
37 return 0;
38 }