1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-23 00:28:11 +00:00

Set up maximum length of example hash

Fixes GH-3382
This commit is contained in:
Konrad Goławski 2022-07-25 22:29:49 +02:00
parent d15793a8b8
commit 336b9c38c8

View File

@ -17,6 +17,8 @@
#include "timer.h" #include "timer.h"
#include "terminal.h" #include "terminal.h"
#define MAXIMUM_EXAMPLE_HASH_LENGTH (128)
static const size_t TERMINAL_LINE_LENGTH = 79; static const size_t TERMINAL_LINE_LENGTH = 79;
static const char *const PROMPT_ACTIVE = "[s]tatus [p]ause [b]ypass [c]heckpoint [f]inish [q]uit => "; static const char *const PROMPT_ACTIVE = "[s]tatus [p]ause [b]ypass [c]heckpoint [f]inish [q]uit => ";
@ -835,11 +837,21 @@ void hash_info_single (hashcat_ctx_t *hashcat_ctx, user_options_extra_t *user_op
{ {
event_log_info (hashcat_ctx, " Example.Hash.Format.: hex-encoded (binary file only)"); event_log_info (hashcat_ctx, " Example.Hash.Format.: hex-encoded (binary file only)");
} }
event_log_info (hashcat_ctx, " Example.Hash........: %s", hashconfig->st_hash);
} }
else else
{ {
event_log_info (hashcat_ctx, " Example.Hash.Format.: plain"); event_log_info (hashcat_ctx, " Example.Hash.Format.: plain");
}
if (strlen (hashconfig->st_hash) > MAXIMUM_EXAMPLE_HASH_LENGTH) {
char st_hash[MAXIMUM_EXAMPLE_HASH_LENGTH + 1] = { '\0' };
strncpy (st_hash, hashconfig->st_hash, MAXIMUM_EXAMPLE_HASH_LENGTH - 3);
strcpy (st_hash + MAXIMUM_EXAMPLE_HASH_LENGTH - 3, "...");
event_log_info (hashcat_ctx, " Example.Hash........: [too long example hash for your terminal, use --machine-readable]");
event_log_info (hashcat_ctx, " %s", st_hash);
} else {
event_log_info (hashcat_ctx, " Example.Hash........: %s", hashconfig->st_hash); event_log_info (hashcat_ctx, " Example.Hash........: %s", hashconfig->st_hash);
} }