#include #include #define _CRT_SECURE_NO_WARNINGS #include #include #include "polynomial.h" using namespace std; using namespace pol; int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); //return a.exec(); if (argc > 0 && argv) { try { hash_nm::precalc_mul_table(); FILE *fout = fopen("encryptedMessage", "wb"); File in("message.txt", READ); pol_t kx = get_rand_pol(KEY_DEG, false); pol_t ky = get_rand_pol(KEY_DEG, false); QTime timer; timer.start(); // generacion de clave? pol3v_t D = get_open_key(kx, ky); int runtime = timer.elapsed(); //gets the runtime in ms qDebug(qPrintable("key generation: "+QString::number(runtime)+" ms")); timer.start(); encrypt(in, fout, D); runtime = timer.elapsed(); //gets the runtime in ms qDebug(qPrintable("encryption duration: "+QString::number(runtime)+" ms")); fclose(fout); in.~File(); FILE *fin = fopen("encryptedMessage", "rb"); File out("decryptedMessage.txt", WRITE); timer.start(); decrypt(fin, out, kx, ky); runtime = timer.elapsed(); //gets the runtime in ms qDebug(qPrintable("decryption duration: "+QString::number(runtime)+" ms")); fclose(fin); out.close(); } catch (char *str) { printf("exception"); cout << str << endl; qDebug("catch"); scanf("\n"); } } qDebug("salida."); return 0; }