#include <iostream>
#include <iomanip>
#include <set>
#include <string>
#include <cstdlib>
#include <ctime>
#include "BPhysTools/SimpleEncrypter.h"
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 25 of file createBlindingKeys.cxx.
32 if (
arg ==
"-c" ) doCheck =
true;
44 std::cout << std::endl;
45 std::cout <<
"Blinding keys generated:" << std::endl;
46 std::cout <<
" Private key: " <<
keys.first << std::endl;
47 std::cout <<
" Public key: " <<
keys.second << std::endl;
48 std::cout << std::endl;
52 srand(
static_cast<unsigned>(
time(0)));
54 std::cout <<
"Encryption test:" << std::endl;
56 for (
int i=0;
i<nChecks; ++
i) {
58 static_cast <float>(
rand())/(
static_cast <float> (RAND_MAX));
62 if ( dec ==
val ) ++nOK;
63 if (
i == 0 || dec !=
val ) {
64 std::cout <<
" Test # " <<
i << std::endl;
65 std::cout <<
" val = " <<
val << std::endl;
66 std::cout <<
" enc = " << enc << std::endl;
67 std::cout <<
" dec = " << dec << std::endl;
69 std::cout <<
" => worked!" << std::endl;
71 std::cout <<
" => FAILED!" << std::endl;
75 std::cout << std::endl;
76 std::cout <<
"Summary:" << std::endl;
77 std::cout <<
" nChecks: " << std::setw(12) << nChecks << std::endl;
78 std::cout <<
" nOK : " << std::setw(12) << nOK << std::endl;
79 std::cout <<
" nFailed: " << std::setw(12) << nChecks - nOK << std::endl;