interfaz
Last change
on this file since b469dad was
b939736,
checked in by Fundación CENDITEL <cenditel@…>, 8 years ago
|
Agregado directorio testVarieties
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | #include <QCoreApplication> |
---|
2 | #include <QTime> |
---|
3 | |
---|
4 | |
---|
5 | #define _CRT_SECURE_NO_WARNINGS |
---|
6 | |
---|
7 | #include <iostream> |
---|
8 | #include <ctime> |
---|
9 | #include "polynomial.h" |
---|
10 | |
---|
11 | |
---|
12 | |
---|
13 | using namespace std; |
---|
14 | using namespace pol; |
---|
15 | |
---|
16 | |
---|
17 | int main(int argc, char *argv[]) |
---|
18 | { |
---|
19 | QCoreApplication a(argc, argv); |
---|
20 | |
---|
21 | //return a.exec(); |
---|
22 | |
---|
23 | if (argc > 0 && argv) { |
---|
24 | try { |
---|
25 | hash_nm::precalc_mul_table(); |
---|
26 | |
---|
27 | FILE *fout = fopen("out", "wb"); |
---|
28 | File in("in.txt", READ); |
---|
29 | |
---|
30 | pol_t kx = get_rand_pol(KEY_DEG, false); |
---|
31 | pol_t ky = get_rand_pol(KEY_DEG, false); |
---|
32 | |
---|
33 | QTime timer; |
---|
34 | timer.start(); |
---|
35 | |
---|
36 | // generacion de clave? |
---|
37 | pol3v_t D = get_open_key(kx, ky); |
---|
38 | |
---|
39 | int runtime = timer.elapsed(); //gets the runtime in ms |
---|
40 | qDebug(qPrintable("key generation: "+QString::number(runtime)+" ms")); |
---|
41 | |
---|
42 | timer.start(); |
---|
43 | encrypt(in, fout, D); |
---|
44 | runtime = timer.elapsed(); //gets the runtime in ms |
---|
45 | qDebug(qPrintable("encryption duration: "+QString::number(runtime)+" ms")); |
---|
46 | |
---|
47 | fclose(fout); |
---|
48 | in.~File(); |
---|
49 | |
---|
50 | FILE *fin = fopen("out", "rb"); |
---|
51 | File out("out2", WRITE); |
---|
52 | |
---|
53 | timer.start(); |
---|
54 | decrypt(fin, out, kx, ky); |
---|
55 | runtime = timer.elapsed(); //gets the runtime in ms |
---|
56 | qDebug(qPrintable("decryption duration: "+QString::number(runtime)+" ms")); |
---|
57 | |
---|
58 | fclose(fin); |
---|
59 | out.close(); |
---|
60 | |
---|
61 | } |
---|
62 | catch (char *str) { |
---|
63 | |
---|
64 | printf("exception"); |
---|
65 | |
---|
66 | cout << str << endl; |
---|
67 | |
---|
68 | qDebug("catch"); |
---|
69 | |
---|
70 | scanf("\n"); |
---|
71 | } |
---|
72 | } |
---|
73 | |
---|
74 | |
---|
75 | |
---|
76 | qDebug("salida."); |
---|
77 | |
---|
78 | return 0; |
---|
79 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.