From 3c40b88eff46cde5b8a8b78fdd7b00001fbc883c Mon Sep 17 00:00:00 2001 From: jsteube Date: Wed, 30 Nov 2016 11:12:56 +0100 Subject: [PATCH] Status: Do not show Recovered/Time as floats but as integers to reduce over-information --- docs/changes.txt | 1 + include/status.h | 6 +++--- src/status.c | 26 +++++++++++++------------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 58ad91d26..ab655ca54 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -164,6 +164,7 @@ The CLI (hashcat.bin or hashcat.exe) works as before but from a technical perspe - Status: Added Input.Queue.Base and Input.Queue.Mod to help the user better understand this concept - Status: Do not wait for the progress mutex to read and store speed timer - Status: Do not show Recovered/Time when cracking < 1000 hashes +- Status: Do not show Recovered/Time as floats but as integers to reduce over-information - Tests: Removed rules_test/ subproject: Would require total rewrite but not used in a long time - Threads: Replaced all calls to getpwuid() with getpwuid_r() to ensure thread safety - Threads: Replaced all calls to gmtime() with gmtime_r() to ensure thread safety diff --git a/include/status.h b/include/status.h index 239363e4e..0f28bee2d 100644 --- a/include/status.h +++ b/include/status.h @@ -74,9 +74,9 @@ char *status_get_speed_sec_dev (const hashcat_ctx_t *hashcat_ctx, int status_get_cpt_cur_min (const hashcat_ctx_t *hashcat_ctx); int status_get_cpt_cur_hour (const hashcat_ctx_t *hashcat_ctx); int status_get_cpt_cur_day (const hashcat_ctx_t *hashcat_ctx); -double status_get_cpt_avg_min (const hashcat_ctx_t *hashcat_ctx); -double status_get_cpt_avg_hour (const hashcat_ctx_t *hashcat_ctx); -double status_get_cpt_avg_day (const hashcat_ctx_t *hashcat_ctx); +int status_get_cpt_avg_min (const hashcat_ctx_t *hashcat_ctx); +int status_get_cpt_avg_hour (const hashcat_ctx_t *hashcat_ctx); +int status_get_cpt_avg_day (const hashcat_ctx_t *hashcat_ctx); char *status_get_cpt (const hashcat_ctx_t *hashcat_ctx); char *status_get_hwmon_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id); int status_get_corespeed_dev (const hashcat_ctx_t *hashcat_ctx, const int device_id); diff --git a/src/status.c b/src/status.c index b4cf4a9d0..0874520de 100644 --- a/src/status.c +++ b/src/status.c @@ -1481,7 +1481,7 @@ int status_get_cpt_cur_day (const hashcat_ctx_t *hashcat_ctx) return cpt_cur_day; } -double status_get_cpt_avg_min (const hashcat_ctx_t *hashcat_ctx) +int status_get_cpt_avg_min (const hashcat_ctx_t *hashcat_ctx) { const cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx; @@ -1489,10 +1489,10 @@ double status_get_cpt_avg_min (const hashcat_ctx_t *hashcat_ctx) const double cpt_avg_min = (double) cpt_ctx->cpt_total / ((msec_real / 1000) / 60); - return cpt_avg_min; + return (int) cpt_avg_min; } -double status_get_cpt_avg_hour (const hashcat_ctx_t *hashcat_ctx) +int status_get_cpt_avg_hour (const hashcat_ctx_t *hashcat_ctx) { const cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx; @@ -1500,10 +1500,10 @@ double status_get_cpt_avg_hour (const hashcat_ctx_t *hashcat_ctx) const double cpt_avg_hour = (double) cpt_ctx->cpt_total / ((msec_real / 1000) / 3600); - return cpt_avg_hour; + return (int) cpt_avg_hour; } -double status_get_cpt_avg_day (const hashcat_ctx_t *hashcat_ctx) +int status_get_cpt_avg_day (const hashcat_ctx_t *hashcat_ctx) { const cpt_ctx_t *cpt_ctx = hashcat_ctx->cpt_ctx; @@ -1511,7 +1511,7 @@ double status_get_cpt_avg_day (const hashcat_ctx_t *hashcat_ctx) const double cpt_avg_day = (double) cpt_ctx->cpt_total / ((msec_real / 1000) / 86400); - return cpt_avg_day; + return (int) cpt_avg_day; } char *status_get_cpt (const hashcat_ctx_t *hashcat_ctx) @@ -1526,13 +1526,13 @@ char *status_get_cpt (const hashcat_ctx_t *hashcat_ctx) const int cpt_cur_hour = status_get_cpt_cur_hour (hashcat_ctx); const int cpt_cur_day = status_get_cpt_cur_day (hashcat_ctx); - const double cpt_avg_min = status_get_cpt_avg_min (hashcat_ctx); - const double cpt_avg_hour = status_get_cpt_avg_hour (hashcat_ctx); - const double cpt_avg_day = status_get_cpt_avg_day (hashcat_ctx); + const int cpt_avg_min = status_get_cpt_avg_min (hashcat_ctx); + const int cpt_avg_hour = status_get_cpt_avg_hour (hashcat_ctx); + const int cpt_avg_day = status_get_cpt_avg_day (hashcat_ctx); if ((cpt_ctx->cpt_start + 86400) < now) { - snprintf (cpt, HCBUFSIZ_TINY - 1, "CUR:%d,%d,%d AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)", + snprintf (cpt, HCBUFSIZ_TINY - 1, "CUR:%d,%d,%d AVG:%d,%d,%d (Min,Hour,Day)", cpt_cur_min, cpt_cur_hour, cpt_cur_day, @@ -1542,7 +1542,7 @@ char *status_get_cpt (const hashcat_ctx_t *hashcat_ctx) } else if ((cpt_ctx->cpt_start + 3600) < now) { - snprintf (cpt, HCBUFSIZ_TINY - 1, "CUR:%d,%d,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)", + snprintf (cpt, HCBUFSIZ_TINY - 1, "CUR:%d,%d,N/A AVG:%d,%d,%d (Min,Hour,Day)", cpt_cur_min, cpt_cur_hour, cpt_avg_min, @@ -1551,7 +1551,7 @@ char *status_get_cpt (const hashcat_ctx_t *hashcat_ctx) } else if ((cpt_ctx->cpt_start + 60) < now) { - snprintf (cpt, HCBUFSIZ_TINY - 1, "CUR:%d,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)", + snprintf (cpt, HCBUFSIZ_TINY - 1, "CUR:%d,N/A,N/A AVG:%d,%d,%d (Min,Hour,Day)", cpt_cur_min, cpt_avg_min, cpt_avg_hour, @@ -1559,7 +1559,7 @@ char *status_get_cpt (const hashcat_ctx_t *hashcat_ctx) } else { - snprintf (cpt, HCBUFSIZ_TINY - 1, "CUR:N/A,N/A,N/A AVG:%0.2f,%0.2f,%0.2f (Min,Hour,Day)", + snprintf (cpt, HCBUFSIZ_TINY - 1, "CUR:N/A,N/A,N/A AVG:%d,%d,%d (Min,Hour,Day)", cpt_avg_min, cpt_avg_hour, cpt_avg_day);