int ext_filter_body(char *in, char *out) { unsigned char *internal; c_int *external; internal = (unsigned char *)in; external = ext_word; external[0] = internal[0]; external[1] = internal[1]; external[2] = internal[2]; external[3] = internal[3]; if (external[0] && external[1] && external[2] && external[3]) do { if (!(external[4] = internal[4])) break; if (!(external[5] = internal[5])) break; if (!(external[6] = internal[6])) break; if (!(external[7] = internal[7])) break; internal += 4; external += 4; } while (1); c_execute_fast(f_filter); if (!ext_word[0] && in[0]) return 0; internal = (unsigned char *)out; external = ext_word; internal[0] = external[0]; internal[1] = external[1]; internal[2] = external[2]; internal[3] = external[3]; if (external[0] && external[1] && external[2] && external[3]) do { if (!(internal[4] = external[4])) break; if (!(internal[5] = external[5])) break; if (!(internal[6] = external[6])) break; if (!(internal[7] = external[7])) break; internal += 4; external += 4; } while (1); out[maxlen] = 0; return 1; }
void do_external_crack(struct db_main *db) { unsigned char *internal; c_int *external; log_event("Proceeding with external mode: %.100s", ext_mode); #ifdef HAVE_MPI if (mpi_p > 1) log_event("MPI: each node will process 1/%u of candidates", mpi_p); #endif internal = (unsigned char *)int_word; external = ext_word; while (*external) *internal++ = *external++; *internal = 0; status_init(&get_progress, 0); rec_restore_mode(restore_state); rec_init(db, save_state); crk_init(db, fix_state, NULL); do { c_execute_fast(f_generate); if (!ext_word[0]) break; if (f_filter) { c_execute_fast(f_filter); if (!ext_word[0]) continue; } #ifdef HAVE_MPI // MPI distribution if (mpi_line++ % mpi_p != mpi_id) continue; #endif int_word[0] = ext_word[0]; if ((int_word[1] = ext_word[1])) { internal = (unsigned char *)&int_word[2]; external = &ext_word[2]; do { if (!(internal[0] = external[0])) break; if (!(internal[1] = external[1])) break; if (!(internal[2] = external[2])) break; if (!(internal[3] = external[3])) break; internal += 4; external += 4; } while (1); } int_word[maxlen] = 0; if (crk_process_key(int_word)) break; } while (1); if (!event_abort) progress = 100; // For reporting DONE after a no-ETA run crk_done(); rec_done(event_abort); }
void do_external_crack(struct db_main *db) { unsigned char *internal; c_int *external; int my_words, their_words; log_event("Proceeding with external mode: %.100s", ext_mode); internal = (unsigned char *)int_word; external = ext_word; while (*external) *internal++ = *external++; *internal = 0; seq = 0; status_init(&get_progress, 0); rec_restore_mode(restore_state); rec_init(db, save_state); crk_init(db, fix_state, NULL); my_words = options.node_max - options.node_min + 1; their_words = options.node_min - 1; if (seq) { /* Restored session. seq is right after a word we've actually used. */ int for_node = seq % options.node_count + 1; if (for_node < options.node_min || for_node > options.node_max) { /* We assume that seq is at the beginning of other nodes' block */ their_words = options.node_count - my_words; } else { my_words = options.node_max - for_node + 1; their_words = 0; } } do { c_execute_fast(f_generate); if (!ext_word[0]) break; if (options.node_count) { seq++; if (their_words) { their_words--; continue; } if (--my_words == 0) { my_words = options.node_max - options.node_min + 1; their_words = options.node_count - my_words; } } if (f_filter) { c_execute_fast(f_filter); if (!ext_word[0]) continue; } int_word[0] = ext_word[0]; if ((int_word[1] = ext_word[1])) { internal = (unsigned char *)&int_word[2]; external = &ext_word[2]; do { if (!(internal[0] = external[0])) break; if (!(internal[1] = external[1])) break; if (!(internal[2] = external[2])) break; if (!(internal[3] = external[3])) break; internal += 4; external += 4; } while (1); } int_word[maxlen] = 0; if (options.mask) { if (do_mask_crack(int_word)) break; } else if (crk_process_key(int_word)) break; } while (1); if (!event_abort) progress = 100; // For reporting DONE after a no-ETA run crk_done(); rec_done(event_abort); }