Index: testVarieties/.gitignore
===================================================================
--- testVarieties/.gitignore	(revision 130b818b86cd7f3da45f27d7ed0aabff883465c7)
+++ testVarieties/.gitignore	(revision ec3ce2ce85518c95b6772d67980db697b37089a9)
@@ -4,2 +4,4 @@
 out
 out2
+decryptedMessage.txt
+encryptedMessage
Index: testVarieties/in.txt
===================================================================
--- testVarieties/in.txt	(revision b9397368a96a4081448c46a75231de7ed4d0d28d)
+++ 	(revision )
@@ -1,20 +1,0 @@
-Esto es un archivo hola mundo.
-total 2684
--rw-r--r-- 1 aaraujo aaraujo   1847 ene  4 16:05 hash.cpp
--rw-r--r-- 1 aaraujo aaraujo    215 ene  4 16:05 hash.h
--rw-r--r-- 1 aaraujo aaraujo  49480 ene  4 16:08 hash.o
--rw-r--r-- 1 aaraujo aaraujo     31 ene  4 16:13 in.txt
--rw-r--r-- 1 aaraujo aaraujo   1659 ene  4 16:26 main.cpp
--rw-r--r-- 1 aaraujo aaraujo 768080 ene  4 16:26 main.o
--rw-r--r-- 1 aaraujo aaraujo  34945 ene  4 16:08 Makefile
--rw-r--r-- 1 aaraujo aaraujo  11505 ene  4 16:27 out
--rw-r--r-- 1 aaraujo aaraujo      0 ene  4 16:27 out2
--rw-r--r-- 1 aaraujo aaraujo   2886 ene  4 16:09 polinomial.hpp
--rw-r--r-- 1 aaraujo aaraujo  20219 ene  4 16:06 polynomial.cpp
--rw-r--r-- 1 aaraujo aaraujo   4647 ene  4 16:06 polynomial.h
--rw-r--r-- 1 aaraujo aaraujo 970864 ene  4 16:09 polynomial.o
--rw-r--r-- 1 aaraujo aaraujo   5495 ene  4 16:06 resource.h
--rwxr-xr-x 1 aaraujo aaraujo 807010 ene  4 16:26 testVarieties
--rw-r--r-- 1 aaraujo aaraujo    287 ene  4 16:08 testVarieties.pro
--rw-r--r-- 1 aaraujo aaraujo  23948 ene  4 16:08 testVarieties.pro.user
--rw-r--r-- 1 aaraujo aaraujo    652 ene  4 16:06 types.h
Index: testVarieties/main.cpp
===================================================================
--- testVarieties/main.cpp	(revision 130b818b86cd7f3da45f27d7ed0aabff883465c7)
+++ testVarieties/main.cpp	(revision ec3ce2ce85518c95b6772d67980db697b37089a9)
@@ -26,6 +26,6 @@
             hash_nm::precalc_mul_table();
 
-            FILE *fout = fopen("out", "wb");
-            File in("in.txt", READ);
+            FILE *fout = fopen("encryptedMessage", "wb");
+            File in("message.txt", READ);
 
             pol_t kx = get_rand_pol(KEY_DEG, false);
@@ -49,6 +49,6 @@
             in.~File();
 
-            FILE *fin = fopen("out", "rb");
-            File out("out2", WRITE);
+            FILE *fin = fopen("encryptedMessage", "rb");
+            File out("decryptedMessage.txt", WRITE);
 
             timer.start();
Index: testVarieties/message.txt
===================================================================
--- testVarieties/message.txt	(revision ec3ce2ce85518c95b6772d67980db697b37089a9)
+++ testVarieties/message.txt	(revision ec3ce2ce85518c95b6772d67980db697b37089a9)
@@ -0,0 +1,20 @@
+Esto es un archivo hola mundo.
+total 2684
+-rw-r--r-- 1 aaraujo aaraujo   1847 ene  4 16:05 hash.cpp
+-rw-r--r-- 1 aaraujo aaraujo    215 ene  4 16:05 hash.h
+-rw-r--r-- 1 aaraujo aaraujo  49480 ene  4 16:08 hash.o
+-rw-r--r-- 1 aaraujo aaraujo     31 ene  4 16:13 in.txt
+-rw-r--r-- 1 aaraujo aaraujo   1659 ene  4 16:26 main.cpp
+-rw-r--r-- 1 aaraujo aaraujo 768080 ene  4 16:26 main.o
+-rw-r--r-- 1 aaraujo aaraujo  34945 ene  4 16:08 Makefile
+-rw-r--r-- 1 aaraujo aaraujo  11505 ene  4 16:27 out
+-rw-r--r-- 1 aaraujo aaraujo      0 ene  4 16:27 out2
+-rw-r--r-- 1 aaraujo aaraujo   2886 ene  4 16:09 polinomial.hpp
+-rw-r--r-- 1 aaraujo aaraujo  20219 ene  4 16:06 polynomial.cpp
+-rw-r--r-- 1 aaraujo aaraujo   4647 ene  4 16:06 polynomial.h
+-rw-r--r-- 1 aaraujo aaraujo 970864 ene  4 16:09 polynomial.o
+-rw-r--r-- 1 aaraujo aaraujo   5495 ene  4 16:06 resource.h
+-rwxr-xr-x 1 aaraujo aaraujo 807010 ene  4 16:26 testVarieties
+-rw-r--r-- 1 aaraujo aaraujo    287 ene  4 16:08 testVarieties.pro
+-rw-r--r-- 1 aaraujo aaraujo  23948 ene  4 16:08 testVarieties.pro.user
+-rw-r--r-- 1 aaraujo aaraujo    652 ene  4 16:06 types.h
Index: testVarieties/polinomial.hpp
===================================================================
--- testVarieties/polinomial.hpp	(revision 130b818b86cd7f3da45f27d7ed0aabff883465c7)
+++ testVarieties/polinomial.hpp	(revision ec3ce2ce85518c95b6772d67980db697b37089a9)
@@ -38,27 +38,27 @@
 	u61_t a = x[CLOSE_KEY_DEG].inverse() * y[CLOSE_KEY_DEG].inverse();
 	for (u32_t j = 0; j < factor.size(); ++j) {
-		res.clear();
-		m = m1 % (fc / factor[j]);
-		u32_t deg = m.get_deg();
-		u64_t size = m[deg] * a.pow(deg / (2 * CLOSE_KEY_DEG));
-		m %= kxy.pow(deg / (2 * CLOSE_KEY_DEG)) * pol_x.pow(deg % (2 * CLOSE_KEY_DEG));
-		deg = m.get_deg();
-		for (u32_t i = 0; i <= deg; ++i) {
-			res.push_back(m[deg - i] * a.pow((deg - i) / (2 * CLOSE_KEY_DEG)));
-			m %= kxy.pow((deg - i) / (2 * CLOSE_KEY_DEG)) * pol_x.pow((deg - i) % (2 * CLOSE_KEY_DEG));
-		}
-		block512_t h2 = hash_nm::hash((char *)(res.data()), res.size() * sizeof(u61_t));
-		if (h1 == h2) {
-//			for (u32_t i = 0; i < res.size(); ++i) {
-//				if (size > MODSIZE - 1) {
-//					size -= out.write(res[i]);
-//				}
-//				else {
-//					size -= out.write(res[i], size);
-//				}
-//			}
-			out.flush();
-			break;
-		}
+            res.clear();
+            m = m1 % (fc / factor[j]);
+            u32_t deg = m.get_deg();
+            u64_t size = m[deg] * a.pow(deg / (2 * CLOSE_KEY_DEG));
+            m %= kxy.pow(deg / (2 * CLOSE_KEY_DEG)) * pol_x.pow(deg % (2 * CLOSE_KEY_DEG));
+            deg = m.get_deg();
+            for (u32_t i = 0; i <= deg; ++i) {
+                res.push_back(m[deg - i] * a.pow((deg - i) / (2 * CLOSE_KEY_DEG)));
+                m %= kxy.pow((deg - i) / (2 * CLOSE_KEY_DEG)) * pol_x.pow((deg - i) % (2 * CLOSE_KEY_DEG));
+            }
+            block512_t h2 = hash_nm::hash((char *)(res.data()), res.size() * sizeof(u61_t));
+
+            // escritura del mensaje cifrado en el archivo de salida
+            for (u32_t i = 0; i < res.size(); ++i) {
+                if (size > MODSIZE - 1) {
+                    size -= out.write(res[i]);
+                }
+                else {
+                    size -= out.write(res[i], size);
+                }
+            }
+            out.flush();
+            break;
 	}
 }
