Set up maximum length of example hash

Fixes GH-3382
pull/3395/head
Konrad Goławski 2 years ago
parent d15793a8b8
commit 336b9c38c8

@ -17,6 +17,8 @@
#include "timer.h"
#include "terminal.h"
#define MAXIMUM_EXAMPLE_HASH_LENGTH (128)
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 => ";
@ -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........: %s", hashconfig->st_hash);
}
else
{
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);
}

Loading…
Cancel
Save