static void status_print_stdout(char *percent) { unsigned int time = status_get_time(); char s_wps[64]; char s_words[32]; int64 current, next, rem; char *s_words_ptr; s_words_ptr = &s_words[sizeof(s_words) - 1]; *s_words_ptr = 0; current = status.crypts; do { next = current; div64by32(&next, 10); rem = next; mul64by32(&rem, 10); neg64(&rem); add64to64(&rem, ¤t); *--s_words_ptr = rem.lo + '0'; current = next; } while (current.lo || current.hi); fprintf(stderr, "words: %s " "time: %u:%02u:%02u:%02u" "%s%s " "w/s: %s", s_words_ptr, time / 86400, time % 86400 / 3600, time % 3600 / 60, time % 60, strncmp(percent, " 100", 4) ? percent : " DONE", status_get_ETA(percent, time), status_get_cps(s_wps)); if ((options.flags & FLG_STATUS_CHK) || !(status.crypts.lo | status.crypts.hi)) fputc('\n', stderr); else fprintf(stderr, " current: %s\n", crk_get_key1()); }
static void status_print_cracking(char *percent) { unsigned int time = status_get_time(); char *key, saved_key[PLAINTEXT_BUFFER_SIZE] = ""; char s_cps[64], cand[32] = ""; emms(); if (!(options.flags & FLG_STATUS_CHK)) if ((key = crk_get_key2())) strnzcpy(saved_key, key, PLAINTEXT_BUFFER_SIZE); if (showcand) sprintf(cand, "/%.0f", (double)((long long)status.crypts.hi << 32) + status.crypts.lo); #ifdef HAVE_MPI // we need to print until cr in one call, otherwise output gets interleaved char nodeid[11] = ""; if (mpi_p > 1) snprintf(nodeid, sizeof(nodeid), "%3d: ", mpi_id); nodeid[sizeof(nodeid)-1] = 0; char trying[256]; if ((options.flags & FLG_STATUS_CHK) || !(status.crypts.lo | status.crypts.hi)) trying[0] = 0; else { UTF8 t1buf[PLAINTEXT_BUFFER_SIZE + 1]; UTF8 t2buf[PLAINTEXT_BUFFER_SIZE + 1]; char *t1, *t2; if (options.report_utf8 && !options.utf8) { t1 = (char*)enc_to_utf8_r(crk_get_key1(), t1buf, PLAINTEXT_BUFFER_SIZE); t2 = (char*)enc_to_utf8_r(saved_key, t2buf, PLAINTEXT_BUFFER_SIZE); } else { t1 = crk_get_key1(); t2 = saved_key; } snprintf(trying, sizeof(trying), "%strying: %s%s%s", mpi_p > 1 ? " " : " ", t1, t2[0] ? " - " : "", t2); } fprintf(stderr, "%s" "guesses: %u%s%s" "time: %u:%02u:%02u:%02u" "%s%s%s" "c/s: %s" "%s\n", nodeid, status.guess_count, cand, mpi_p > 1 ? " " : " ", time / 86400, time % 86400 / 3600, time % 3600 / 60, time % 60, strncmp(percent, " 100", 4) ? percent : " DONE", status_get_ETA(percent,time), mpi_p > 1 ? " " : " ", status_get_cps(s_cps), trying); #else fprintf(stderr, "guesses: %u%s " "time: %u:%02u:%02u:%02u" "%s%s " "c/s: %s", status.guess_count, cand, time / 86400, time % 86400 / 3600, time % 3600 / 60, time % 60, strncmp(percent, " 100", 4) ? percent : " DONE", status_get_ETA(percent,time), status_get_cps(s_cps)); if ((options.flags & FLG_STATUS_CHK) || !(status.crypts.lo | status.crypts.hi)) fputc('\n', stderr); else { UTF8 t1buf[PLAINTEXT_BUFFER_SIZE + 1]; UTF8 t2buf[PLAINTEXT_BUFFER_SIZE + 1]; char *t1, *t2; if (options.report_utf8 && !options.utf8) { t1 = (char*)enc_to_utf8_r(crk_get_key1(), t1buf, PLAINTEXT_BUFFER_SIZE); t2 = (char*)enc_to_utf8_r(saved_key, t2buf, PLAINTEXT_BUFFER_SIZE); } else { t1 = crk_get_key1(); t2 = saved_key; } fprintf(stderr, " trying: %s%s%s\n", t1, t2[0] ? " - " : "", t2); } #endif }
static void status_print_cracking(char *percent) { unsigned int time = status_get_time(); char *key1, key2[PLAINTEXT_BUFFER_SIZE]; UTF8 t1buf[PLAINTEXT_BUFFER_SIZE + 1]; int64 g; char s_gps[32], s_pps[32], s_crypts_ps[32], s_combs_ps[32]; char s[1024], *p; char sc[32]; int n; key1 = NULL; key2[0] = 0; if (!(options.flags & FLG_STATUS_CHK) && (status.crypts.lo | status.crypts.hi)) { char *key = crk_get_key2(); if (key) strnzcpy(key2, key, sizeof(key2)); key1 = crk_get_key1(); if (options.report_utf8 && !options.utf8) { UTF8 t2buf[PLAINTEXT_BUFFER_SIZE + 1]; char *t; key1 = (char*)enc_to_utf8_r(key1, t1buf, PLAINTEXT_BUFFER_SIZE); t = (char*)enc_to_utf8_r(key2, t2buf, PLAINTEXT_BUFFER_SIZE); strnzcpy(key2, t, sizeof(key2)); } } p = s; #ifndef HAVE_MPI if (options.fork) { #else if (options.fork || mpi_p > 1) { #endif n = sprintf(p, "%u ", options.node_min); if (n > 0) p += n; } if (showcand) { unsigned long long cands = ((unsigned long long) status.cands.hi << 32) + status.cands.lo; sprintf(sc, " %llup", cands); } g.lo = status.guess_count; g.hi = 0; n = sprintf(p, "%ug%s %u:%02u:%02u:%02u%.100s%s %.31sg/s ", status.guess_count, showcand ? sc : "", time / 86400, time % 86400 / 3600, time % 3600 / 60, time % 60, strncmp(percent, " 100", 4) ? percent : " DONE", status_get_ETA(percent,time), status_get_cps(s_gps, &g, 0)); if (n > 0) p += n; if (!status.compat) { n = sprintf(p, "%.31sp/s %.31sc/s ", status_get_cps(s_pps, &status.cands, 0), status_get_cps(s_crypts_ps, &status.crypts, 0)); if (n > 0) p += n; } n = sprintf(p, "%.31sC/s%s%.200s%s%.200s\n", status_get_cps(s_combs_ps, &status.combs, status.combs_ehi), key1 ? " " : "", key1 ? key1 : "", key2[0] ? ".." : "", key2); if (n > 0) p += n; fwrite(s, p - s, 1, stderr); } static void status_print_stdout(char *percent) { unsigned int time = status_get_time(); char *key; char s_pps[32], s_p[32]; key = NULL; if (!(options.flags & FLG_STATUS_CHK) && (status.cands.lo | status.cands.hi)) key = crk_get_key1(); fprintf(stderr, "%sp %u:%02u:%02u:%02u%s%s %sp/s%s%s\n", status_get_c(s_p, &status.cands, 0), time / 86400, time % 86400 / 3600, time % 3600 / 60, time % 60, strncmp(percent, " 100", 4) ? percent : " DONE", status_get_ETA(percent,time), status_get_cps(s_pps, &status.cands, 0), key ? " " : "", key ? key : ""); }