From 9657dd26a2a8ee58246be170f17f0c6113d58357 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20Mart=C3=ADnez=20Mart=C3=AD?= Date: Sat, 15 Mar 2008 22:28:06 +0100 Subject: [PATCH] El fichero ya es procesado por el segundo hash por bloques. --- merge3.c | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/merge3.c b/merge3.c index 319c991..8c510a1 100644 --- a/merge3.c +++ b/merge3.c @@ -17,11 +17,22 @@ // Establece cual es el ancho máximo de línea para trabajar. // Establecer como mínimo a 90. Recomendado 128 o 256. #define MAX_LINE 256 +#define MAX_LOADED_LINES 8096 + +const int block_size=8; + +int hashfile1[MAX_LOADED_LINES]; +int hashfile1_size=0; + +int hbfile1[MAX_LOADED_LINES]; +int hbfile1_size=0; + + unsigned int ihash(char *txt); +unsigned int ihash2(unsigned int *data,int nblocks); int hash_loadfile(char *filename); int main(int argc, char **argv) { - const int block_size=2; // Comprobar la entrada de argumentos. if ( argc < 2 ) { fprintf( stderr, "Usage: %s \n", argv[0] ); @@ -152,17 +163,36 @@ int hash_loadfile(char *filename) { return 1; } char *txt; - int n=0; + /* +int hashfile1[MAX_LOADED_LINES]; +int hashfile1_size=0; + +int hbfile1[MAX_LOADED_LINES]; +int hbfile1_size=0; + */ + hashfile1_size=0; + while (txt=fgets(linea, MAX_LINE, fichero)) { - n++; reducetext(txt); - printf( "%d:%08X >%s\n", n,ihash(txt),txt); + hashfile1[hashfile1_size++]=ihash(txt); + // printf( "%d:%08X >%s\n", n,hashfile1[hashfile1_size-1],txt); + hbfile1_size=hashfile1_size-block_size; + if (hbfile1_size>=0 && hbfile1_size