#include #include #include #include #include #include #include #include int main(int argc, char *argv[]){ int rank, size; char test[6]; char *p = (char *)malloc(16*sizeof(char)); char reference[16] = "13J62jdYzdsKI\0"; int a = 0; int b = 0; int c = 0; int d = 0; int e = 0; test[5] = 0; int start, end; clock_t inicio, fin; inicio = clock(); int elapsed; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); start = floor(97 +(26*rank)/size); end = floor(97 + (26*(rank + 1))/size); for(a = 97+rank; a < 123; a+=size){ fprintf(stderr,"En nodo %d buscando: %c ....\n",rank,a); for(b = 97; b < 123; b++){ for(c = 97; c < 123; c++){ for(d = 97; d < 123; d++){ for(e = 97; e < 123; e++){ test[0] = a; test[1] = b; test[2] = c; test[3] = d; test[4] = e; p = crypt(test, "13"); if(strcmp(p,reference) == 0){ fprintf(stderr,"\nujaleeee la encontro en %d: %s\n",rank,test); fin = clock(); elapsed = ((double)(fin-inicio))/CLOCKS_PER_SEC; printf("\ntiempo en segundos: %d\n",elapsed); } } } } } } MPI_Finalize(); printf("no se encontro la clave correspondiente a %s", reference); return 0; }