Add measures and tests.
[crypto_lab3.git] / src / main.cpp
1 /**
2 * ICR - Labo 3.
3 * It uses GMPxx lib and C++11.
4 * It needs the RNG file "/dev/urandom".
5 *
6 * Author: Grégory Burri
7 */
8
9 #include <vector>
10 #include <iostream>
11 using namespace std;
12
13 #include <gmpxx.h>
14
15 #include "Tests.h"
16
17 const uint KEY_SIZE_BITS = 1024;
18 const uint RSA_PUBLIC_EXPONENT = 65537;
19
20 void printUsage(const string& progName)
21 {
22 cout << "Usage: " << progName << " [tests|time-measures]" << endl;
23 }
24
25 int main(int argc, char** argv)
26 {
27 vector<string> args;
28 for (int i = 0; i < argc; i++)
29 args.push_back(string(argv[i]));
30
31 if (args.size() >= 2 && args[1] == "tests")
32 Tests(KEY_SIZE_BITS, RSA_PUBLIC_EXPONENT).runTests();
33 else if (args.size() >= 2 && args[1] == "time-measures")
34 Tests(KEY_SIZE_BITS, RSA_PUBLIC_EXPONENT).runTimeMeasures();
35 else
36 printUsage(args[0]);
37
38 return 0;
39 }