From c54b85a3bede85fbaa1a5082f3bc9fb6050c2487 Mon Sep 17 00:00:00 2001 From: philsmd Date: Wed, 22 Mar 2017 11:52:08 +0100 Subject: [PATCH] minor: cleaned up code and updated docs wrt #1195 --- docs/changes.txt | 1 + src/outfile.c | 15 +-------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index e44379a37..2a55f27cb 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -25,6 +25,7 @@ - Fixed --remove was not applied in case all hashes have been cracked by potfile or weak-hash check - Fixed a race condition when a session finishes the input-base was freed but accessed afterwards - Fixed a hash validation error when trying to load Android FDE < 4.3 hashes +- Fixed --outfile-format 11 up to --outfile-format 15: the crack position was not correctly outputted ## ## Technical diff --git a/src/outfile.c b/src/outfile.c index 006df87fa..373a3fb8b 100644 --- a/src/outfile.c +++ b/src/outfile.c @@ -343,17 +343,6 @@ void outfile_write_close (hashcat_ctx_t *hashcat_ctx) fclose (outfile_ctx->fp); } -int numDigits(u64 number) -{ - int digits = 0; - while (number) { - number /= 10; - digits++; - } - return digits; -} - - int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsigned char *plain_ptr, const u32 plain_len, const u64 crackpos, const unsigned char *username, const u32 user_len, char tmp_buf[HCBUFSIZ_LARGE]) { const hashconfig_t *hashconfig = hashcat_ctx->hashconfig; @@ -444,9 +433,7 @@ int outfile_write (hashcat_ctx_t *hashcat_ctx, const char *out_buf, const unsign if (outfile_ctx->outfile_format & OUTFILE_FMT_CRACKPOS) { - int digit_len = numDigits(crackpos); - snprintf (tmp_buf + tmp_len, HCBUFSIZ_LARGE - tmp_len, "%" PRIu64, crackpos); - tmp_len += digit_len + 1 ; + tmp_len += snprintf (tmp_buf + tmp_len, HCBUFSIZ_LARGE - tmp_len, "%" PRIu64, crackpos); } tmp_buf[tmp_len] = 0;