interfaz
Last change
on this file since 66e8c79 was
130b818,
checked in by aaraujo <aaraujo@…>, 8 years ago
|
Documentación inicial de los archivos fuentes.
|
-
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 | |
---|
14 | using namespace std; |
---|
15 | using namespace pol; |
---|
16 | |
---|
17 | |
---|
18 | int main(int argc, char *argv[]) |
---|
19 | { |
---|
20 | QCoreApplication a(argc, argv); |
---|
21 | |
---|
22 | //return a.exec(); |
---|
23 | |
---|
24 | if (argc > 0 && argv) { |
---|
25 | try { |
---|
26 | hash_nm::precalc_mul_table(); |
---|
27 | |
---|
28 | FILE *fout = fopen("out", "wb"); |
---|
29 | File in("in.txt", READ); |
---|
30 | |
---|
31 | pol_t kx = get_rand_pol(KEY_DEG, false); |
---|
32 | pol_t ky = get_rand_pol(KEY_DEG, false); |
---|
33 | |
---|
34 | QTime timer; |
---|
35 | timer.start(); |
---|
36 | |
---|
37 | // generacion de clave? |
---|
38 | pol3v_t D = get_open_key(kx, ky); |
---|
39 | |
---|
40 | int runtime = timer.elapsed(); //gets the runtime in ms |
---|
41 | qDebug(qPrintable("key generation: "+QString::number(runtime)+" ms")); |
---|
42 | |
---|
43 | timer.start(); |
---|
44 | encrypt(in, fout, D); |
---|
45 | runtime = timer.elapsed(); //gets the runtime in ms |
---|
46 | qDebug(qPrintable("encryption duration: "+QString::number(runtime)+" ms")); |
---|
47 | |
---|
48 | fclose(fout); |
---|
49 | in.~File(); |
---|
50 | |
---|
51 | FILE *fin = fopen("out", "rb"); |
---|
52 | File out("out2", WRITE); |
---|
53 | |
---|
54 | timer.start(); |
---|
55 | decrypt(fin, out, kx, ky); |
---|
56 | runtime = timer.elapsed(); //gets the runtime in ms |
---|
57 | qDebug(qPrintable("decryption duration: "+QString::number(runtime)+" ms")); |
---|
58 | |
---|
59 | fclose(fin); |
---|
60 | out.close(); |
---|
61 | |
---|
62 | } |
---|
63 | catch (char *str) { |
---|
64 | |
---|
65 | printf("exception"); |
---|
66 | |
---|
67 | cout << str << endl; |
---|
68 | |
---|
69 | qDebug("catch"); |
---|
70 | |
---|
71 | scanf("\n"); |
---|
72 | } |
---|
73 | } |
---|
74 | |
---|
75 | |
---|
76 | |
---|
77 | qDebug("salida."); |
---|
78 | |
---|
79 | return 0; |
---|
80 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.