Index: rsa/.gitignore
===================================================================
--- rsa/.gitignore	(revision fafd15646e69e9a7ffc026acae0601928cf5276a)
+++ rsa/.gitignore	(revision fafd15646e69e9a7ffc026acae0601928cf5276a)
@@ -0,0 +1,74 @@
+# This file is used to ignore files which are generated
+# ----------------------------------------------------------------------------
+registro-rsa*
+rsa
+*~
+*.autosave
+*.a
+*.core
+*.moc
+*.o
+*.obj
+*.orig
+*.rej
+*.so
+*.so.*
+*_pch.h.cpp
+*_resource.rc
+*.qm
+.#*
+*.*#
+core
+!core/
+tags
+.DS_Store
+.directory
+*.debug
+Makefile*
+*.prl
+*.app
+moc_*.cpp
+ui_*.h
+qrc_*.cpp
+Thumbs.db
+*.res
+*.rc
+/.qmake.cache
+/.qmake.stash
+
+# qtcreator generated files
+*.pro.user*
+
+# xemacs temporary files
+*.flc
+
+# Vim temporary files
+.*.swp
+
+# Visual Studio generated files
+*.ib_pdb_index
+*.idb
+*.ilk
+*.pdb
+*.sln
+*.suo
+*.vcproj
+*vcproj.*.*.user
+*.ncb
+*.sdf
+*.opensdf
+*.vcxproj
+*vcxproj.*
+
+# MinGW generated files
+*.Debug
+*.Release
+
+# Python byte code
+*.pyc
+
+# Binaries
+# --------
+*.dll
+*.exe
+
Index: rsa/main.cpp
===================================================================
--- rsa/main.cpp	(revision fafd15646e69e9a7ffc026acae0601928cf5276a)
+++ rsa/main.cpp	(revision fafd15646e69e9a7ffc026acae0601928cf5276a)
@@ -0,0 +1,182 @@
+#include <QCoreApplication>
+
+#include <QTime>
+#include <QElapsedTimer>
+#include <QFile>
+#include <QTextStream>
+
+#include <iostream>
+
+#include "crypto++/rsa.h"
+#include "crypto++/elgamal.h"
+#include "crypto++/osrng.h"
+#include <crypto++/files.h>
+
+
+
+/**
+ * Programa de Cryptopp para realizar estimaciones de ejecuciones del
+ * algoritmo RSA
+ *
+ * https://www.cryptopp.com/wiki/RSA_Cryptography
+ *
+ *
+ * Es necesario instalar los siguientes paquetes:
+ * libcrypto++9 y libcrypto++-dev
+ *
+ */
+
+using namespace CryptoPP;
+
+int main(int argc, char *argv[])
+{
+    QCoreApplication a(argc, argv);
+    //return a.exec();
+
+
+    ///////////////////////////////////////
+    // Pseudo Random Number Generator
+    AutoSeededRandomPool rng;
+
+    ///////////////////////////////////////
+    // Generate Parameters
+    //InvertibleRSAFunction params;
+
+    //QTime timer;
+    QElapsedTimer timer;
+
+    // prefijo del nombre del archivo con el texto a cifrar
+    QString messageFile = "message";
+
+    // iterar por el número de archivos (10)
+    for (int i = 1; i <= 2; i++)
+    {
+        messageFile.append(QString::number(i));
+
+        qDebug("generar archivo...");
+        // generar registros en archivo de texto
+        QString fileName = "registro-rsa-";
+        fileName.append(messageFile+"-");
+        fileName.append(QDateTime::currentDateTime().toString("dd.MM.yy.hh.mm.ss"));
+        fileName.append(".txt");
+
+        messageFile.append(".txt");
+
+        std::string s;
+        CryptoPP::FileSource file( qPrintable(messageFile), true, new StringSink( s ) );
+
+        //std::cout << s ;//<< std::endl;
+        //std::cout << s.size() << std::endl;
+
+        // archivo de salida de resultados
+        QFile registerFile(fileName);
+        if (registerFile.open(QFile::WriteOnly))
+        {
+            // flujo para el archivo de salida de resultados
+            QTextStream outFile(&registerFile);
+
+
+            // linea que mantiene los valores de tiempo
+            QString line;
+
+            // iterar 50 veces el proceso de cifrado y descifrado del texto
+            for (int j = 0; j < 50; j++)
+            {
+
+                qDebug("*************************************************");
+                InvertibleRSAFunction params;
+
+                timer.start();
+                params.GenerateRandomWithKeySize(rng, 4096);
+
+                int runtime = timer.elapsed(); //gets the runtime in ms
+                qDebug(qPrintable("key generation: "+QString::number(runtime)+" ms"));
+
+                line.append(QString::number(runtime));
+                line.append(" ");
+
+                ///////////////////////////////////////
+                // Create Keys
+                RSA::PrivateKey privateKey(params);
+                RSA::PublicKey publicKey(params);
+
+                SecByteBlock plaintext( (const unsigned char *) s.data(), s.size() );
+
+
+                ////////////////////////////////////////////////
+                // Encrypt
+                RSAES_OAEP_SHA_Encryptor encryptor( publicKey );
+
+                // Now that there is a concrete object, we can validate
+                assert( 0 != encryptor.FixedMaxPlaintextLength() );
+
+                //qDebug("encryptor.FixedMaxPlaintextLength(): %zu", encryptor.FixedMaxPlaintextLength());
+
+                // vale la pena leer la siguiente pregunta:
+                // https://stackoverflow.com/questions/2033809/im-using-crypto-for-rsa-encryption-my-plain-text-exceeds-fixedmaxplaintextle
+                //
+                // para RSA mas de 470 bytes hace que el asser que sigue falle
+                assert( plaintext.size() <= encryptor.FixedMaxPlaintextLength() );
+
+                // Create cipher text space
+                size_t ecl = encryptor.CiphertextLength( plaintext.size() );
+                assert( 0 != ecl );
+                SecByteBlock ciphertext( ecl );
+
+                timer.start();
+                encryptor.Encrypt( rng, plaintext, plaintext.size(), ciphertext );
+                runtime = timer.elapsed(); //gets the runtime in ms
+                qDebug(qPrintable("RSA encryption time: "+QString::number(runtime)+" ms"));
+
+                line.append(QString::number(runtime));
+                line.append(" ");
+
+
+                ////////////////////////////////////////////////
+                // Decrypt
+                RSAES_OAEP_SHA_Decryptor decryptor( privateKey );
+
+                // Now that there is a concrete object, we can check sizes
+                assert( 0 != decryptor.FixedCiphertextLength() );
+                assert( ciphertext.size() <= decryptor.FixedCiphertextLength() );
+
+                // Create recovered text space
+                size_t dpl = decryptor.MaxPlaintextLength( ciphertext.size() );
+                assert( 0 != dpl );
+                SecByteBlock recovered( dpl );
+
+                timer.start();
+                DecodingResult result = decryptor.Decrypt( rng, ciphertext, ciphertext.size(), recovered );
+                runtime = timer.elapsed(); //gets the runtime in ms
+                qDebug(qPrintable("RSA decryption time: "+QString::number(runtime)+" ms"));
+
+                line.append(QString::number(runtime));
+                line.append(" ");
+
+                // More sanity checks
+                assert( result.isValidCoding );
+                assert( result.messageLength <= decryptor.MaxPlaintextLength( ciphertext.size() ) );
+
+                // At this point, we can set the size of the recovered
+                //  data. Until decryption occurs (successfully), we
+                //  only know its maximum size
+                recovered.resize( result.messageLength );
+
+                // SecByteBlock is overloaded for proper results below
+                assert( plaintext == recovered );
+
+                std::cout << "Recovered plain text" << std::endl;
+
+
+                outFile << line << endl;
+                line = "";
+
+
+            }
+            messageFile = "message";
+        }
+
+    }
+
+    qDebug("salida");
+}
Index: rsa/message1.txt
===================================================================
--- rsa/message1.txt	(revision fafd15646e69e9a7ffc026acae0601928cf5276a)
+++ rsa/message1.txt	(revision fafd15646e69e9a7ffc026acae0601928cf5276a)
@@ -0,0 +1,1 @@
+hola mundo
Index: rsa/message2.txt
===================================================================
--- rsa/message2.txt	(revision fafd15646e69e9a7ffc026acae0601928cf5276a)
+++ rsa/message2.txt	(revision fafd15646e69e9a7ffc026acae0601928cf5276a)
@@ -0,0 +1,1 @@
+hola mundo
Index: rsa/rsa.pro
===================================================================
--- rsa/rsa.pro	(revision fafd15646e69e9a7ffc026acae0601928cf5276a)
+++ rsa/rsa.pro	(revision fafd15646e69e9a7ffc026acae0601928cf5276a)
@@ -0,0 +1,14 @@
+QT += core
+QT -= gui
+
+CONFIG += c++11
+
+TARGET = rsa
+CONFIG += console
+CONFIG -= app_bundle
+
+TEMPLATE = app
+
+SOURCES += main.cpp
+
+LIBS += -lcrypto++
