From c990e252d3d57e1d412415118182f3c6f792c6d3 Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Wed, 21 Jul 2021 15:47:05 +0200 Subject: [PATCH] Added option --multiply-accel-disable (short: -M) to disable multiply the kernel-accel with the multiprocessor count automatism --- docs/changes.txt | 6 ++++++ extra/tab_completion/hashcat.sh | 2 +- include/types.h | 3 +++ src/backend.c | 4 +++- src/interface.c | 5 +++++ src/modules/module_01800.c | 3 ++- src/modules/module_03200.c | 1 + src/usage.c | 1 + src/user_options.c | 18 ++++++++++++++++-- 9 files changed, 38 insertions(+), 5 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 74ed665bd..313914aa5 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -1,5 +1,11 @@ * changes v6.2.3 -> v6.2.x +## +## Features +## + +- Added option --multiply-accel-disable (short: -M) to disable multiply the kernel-accel with the multiprocessor count automatism + ## ## Bugs ## diff --git a/extra/tab_completion/hashcat.sh b/extra/tab_completion/hashcat.sh index 54440e636..7458465a3 100644 --- a/extra/tab_completion/hashcat.sh +++ b/extra/tab_completion/hashcat.sh @@ -426,7 +426,7 @@ _hashcat () local BUILD_IN_CHARSETS='?l ?u ?d ?a ?b ?s ?h ?H' local SHORT_OPTS="-m -a -V -h -b -t -T -o -p -c -d -D -w -n -u -j -k -r -g -1 -2 -3 -4 -i -I -s -l -O -S -z" - local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-json --status-timer --stdin-timeout-abort --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-inverse --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --hash-info --backend-ignore-cuda --backend-ignore-opencl --backend-info --backend-devices --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-disable --hwmon-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --self-test-disable --slow-candidates --brain-server --brain-server-timer --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password --identify" + local LONG_OPTS="--hash-type --attack-mode --version --help --quiet --benchmark --benchmark-all --hex-salt --hex-wordlist --hex-charset --force --status --status-json --status-timer --stdin-timeout-abort --machine-readable --loopback --markov-hcstat2 --markov-disable --markov-inverse --markov-classic --markov-threshold --runtime --session --speed-only --progress-only --restore --restore-file-path --restore-disable --outfile --outfile-format --outfile-autohex-disable --outfile-check-timer --outfile-check-dir --wordlist-autohex-disable --separator --show --left --username --remove --remove-timer --potfile-disable --potfile-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --example-hashes --hash-info --backend-ignore-cuda --backend-ignore-opencl --backend-info --backend-devices --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-disable --hwmon-temp-abort --skip --limit --keyspace --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment --increment-min --increment-max --logfile-disable --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --stdout --keep-guessing --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --optimized-kernel-enable --multiply-accel-disable --self-test-disable --slow-candidates --brain-server --brain-server-timer --brain-client --brain-client-features --brain-host --brain-port --brain-session --brain-session-whitelist --brain-password --identify" local OPTIONS="-m -a -t -o -p -c -d -w -n -u -j -k -r -g -1 -2 -3 -4 -s -l --hash-type --attack-mode --status-timer --stdin-timeout-abort --markov-hcstat2 --markov-threshold --runtime --session --timer --outfile --outfile-format --outfile-check-timer --outfile-check-dir --separator --remove-timer --potfile-path --restore-file-path --debug-mode --debug-file --induction-dir --segment-size --bitmap-min --bitmap-max --cpu-affinity --backend-devices --opencl-device-types --backend-vector-width --workload-profile --kernel-accel --kernel-loops --kernel-threads --spin-damp --hwmon-temp-abort --skip --limit --rule-left --rule-right --rules-file --generate-rules --generate-rules-func-min --generate-rules-func-max --generate-rules-seed --custom-charset1 --custom-charset2 --custom-charset3 --custom-charset4 --hook-threads --increment-min --increment-max --scrypt-tmto --keyboard-layout-mapping --truecrypt-keyfiles --veracrypt-keyfiles --veracrypt-pim-start --veracrypt-pim-stop --hccapx-message-pair --nonce-error-corrections --encoding-from --encoding-to --brain-server-timer --brain-client-features --brain-host --brain-password --brain-port --brain-session --brain-session-whitelist" COMPREPLY=() diff --git a/include/types.h b/include/types.h index 36c16261a..45a7eb332 100644 --- a/include/types.h +++ b/include/types.h @@ -651,6 +651,7 @@ typedef enum user_options_defaults BACKEND_INFO = false, BACKEND_VECTOR_WIDTH = 0, OPTIMIZED_KERNEL_ENABLE = false, + MULTIPLY_ACCEL_DISABLE = false, OUTFILE_AUTOHEX = true, OUTFILE_CHECK_TIMER = 5, OUTFILE_FORMAT = 3, @@ -760,6 +761,7 @@ typedef enum user_options_map IDX_NONCE_ERROR_CORRECTIONS = 0xff2d, IDX_OPENCL_DEVICE_TYPES = 'D', IDX_OPTIMIZED_KERNEL_ENABLE = 'O', + IDX_MULTIPLY_ACCEL_DISABLE = 'M', IDX_OUTFILE_AUTOHEX_DISABLE = 0xff2e, IDX_OUTFILE_CHECK_DIR = 0xff2f, IDX_OUTFILE_CHECK_TIMER = 0xff30, @@ -2130,6 +2132,7 @@ typedef struct user_options bool backend_ignore_opencl; bool backend_info; bool optimized_kernel_enable; + bool multiply_accel_disable; bool outfile_autohex; bool potfile_disable; bool progress_only; diff --git a/src/backend.c b/src/backend.c index c8695d53e..7f61baf57 100644 --- a/src/backend.c +++ b/src/backend.c @@ -14845,7 +14845,9 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx) * 4 (gpus) * 260 (sizeof pw_t) * 3 (pws, pws_comp, pw_pre) * 20 (MCU) * 1024 (threads) * 1024 (accel) = 65,431,142,400 bytes RAM!! */ - const u32 accel_limit = CEILDIV ((64 * 1024), kernel_threads); // this should result in less than 4GB per GPU, but allow higher accel in case user reduces the threads manually using -T + const int max_gb = (hashconfig->opts_type & OPTS_TYPE_MP_MULTI_DISABLE) ? 1024 : 64; + + const u32 accel_limit = CEILDIV ((max_gb * 1024), kernel_threads); // this should result in less than 4GB per GPU, but allow higher accel in case user reduces the threads manually using -T kernel_accel_max = MIN (kernel_accel_max, accel_limit); diff --git a/src/interface.c b/src/interface.c index 1d2eb8538..64c227feb 100644 --- a/src/interface.c +++ b/src/interface.c @@ -265,6 +265,11 @@ int hashconfig_init (hashcat_ctx_t *hashcat_ctx) } } + if (user_options->multiply_accel_disable == true) + { + hashconfig->opts_type |= OPTS_TYPE_MP_MULTI_DISABLE; + } + if (user_options->self_test_disable == true) { hashconfig->opts_type |= OPTS_TYPE_SELF_TEST_DISABLE; diff --git a/src/modules/module_01800.c b/src/modules/module_01800.c index aefab6e3b..98471dd89 100644 --- a/src/modules/module_01800.c +++ b/src/modules/module_01800.c @@ -21,7 +21,8 @@ static const char *HASH_NAME = "sha512crypt $6$, SHA512 (Unix)"; static const u64 KERN_TYPE = 1800; static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE | OPTI_TYPE_USES_BITS_64; -static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; +static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_MP_MULTI_DISABLE; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; static const char *ST_PASS = "hashcat"; static const char *ST_HASH = "$6$72820166$U4DVzpcYxgw7MVVDGGvB2/H5lRistD5.Ah4upwENR5UtffLR4X4SxSzfREv8z6wVl0jRFX40/KnYVvK4829kD1"; diff --git a/src/modules/module_03200.c b/src/modules/module_03200.c index 9f30edadf..ebc60c5ba 100644 --- a/src/modules/module_03200.c +++ b/src/modules/module_03200.c @@ -21,6 +21,7 @@ static const char *HASH_NAME = "bcrypt $2*$, Blowfish (Unix)"; static const u64 KERN_TYPE = 3200; static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE + | OPTS_TYPE_MP_MULTI_DISABLE | OPTS_TYPE_DYNAMIC_SHARED; static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; static const char *ST_PASS = "hashcat"; diff --git a/src/usage.c b/src/usage.c index d8d57ebcd..fbd1b7b4a 100644 --- a/src/usage.c +++ b/src/usage.c @@ -97,6 +97,7 @@ static const char *const USAGE_BIG_PRE_HASHMODES[] = " -d, --backend-devices | Str | Backend devices to use, separated with commas | -d 1", " -D, --opencl-device-types | Str | OpenCL device-types to use, separated with commas | -D 1", " -O, --optimized-kernel-enable | | Enable optimized kernels (limits password length) |", + " -M, --multiply-accel-disable | | Disable multiply kernel-accel with processor count |", " -w, --workload-profile | Num | Enable a specific workload profile, see pool below | -w 3", " -n, --kernel-accel | Num | Manual workload tuning, set outerloop step size to X | -n 64", " -u, --kernel-loops | Num | Manual workload tuning, set innerloop step size to X | -u 256", diff --git a/src/user_options.c b/src/user_options.c index b7e810b14..b9c432d45 100644 --- a/src/user_options.c +++ b/src/user_options.c @@ -20,9 +20,9 @@ #endif #ifdef WITH_BRAIN -static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OSz"; +static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMSz"; #else -static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OS"; +static const char *short_options = "hVvm:a:r:j:k:g:o:t:d:D:n:u:T:c:p:s:l:1:2:3:4:iIbw:OMS"; #endif static const struct option long_options[] = @@ -88,6 +88,7 @@ static const struct option long_options[] = {"nonce-error-corrections", required_argument, NULL, IDX_NONCE_ERROR_CORRECTIONS}, {"opencl-device-types", required_argument, NULL, IDX_OPENCL_DEVICE_TYPES}, {"optimized-kernel-enable", no_argument, NULL, IDX_OPTIMIZED_KERNEL_ENABLE}, + {"multiply-accel-disable", no_argument, NULL, IDX_MULTIPLY_ACCEL_DISABLE}, {"outfile-autohex-disable", no_argument, NULL, IDX_OUTFILE_AUTOHEX_DISABLE}, {"outfile-check-dir", required_argument, NULL, IDX_OUTFILE_CHECK_DIR}, {"outfile-check-timer", required_argument, NULL, IDX_OUTFILE_CHECK_TIMER}, @@ -224,6 +225,7 @@ int user_options_init (hashcat_ctx_t *hashcat_ctx) user_options->nonce_error_corrections = NONCE_ERROR_CORRECTIONS; user_options->opencl_device_types = NULL; user_options->optimized_kernel_enable = OPTIMIZED_KERNEL_ENABLE; + user_options->multiply_accel_disable = MULTIPLY_ACCEL_DISABLE; user_options->outfile_autohex = OUTFILE_AUTOHEX; user_options->outfile_check_dir = NULL; user_options->outfile_check_timer = OUTFILE_CHECK_TIMER; @@ -451,6 +453,7 @@ int user_options_getopt (hashcat_ctx_t *hashcat_ctx, int argc, char **argv) user_options->backend_vector_width_chgd = true; break; case IDX_OPENCL_DEVICE_TYPES: user_options->opencl_device_types = optarg; break; case IDX_OPTIMIZED_KERNEL_ENABLE: user_options->optimized_kernel_enable = true; break; + case IDX_MULTIPLY_ACCEL_DISABLE: user_options->multiply_accel_disable = true; break; case IDX_WORKLOAD_PROFILE: user_options->workload_profile = hc_strtoul (optarg, NULL, 10); user_options->workload_profile_chgd = true; break; case IDX_KERNEL_ACCEL: user_options->kernel_accel = hc_strtoul (optarg, NULL, 10); @@ -1986,6 +1989,11 @@ void user_options_info (hashcat_ctx_t *hashcat_ctx) event_log_info (hashcat_ctx, "* --optimized-kernel-enable"); } + if (user_options->multiply_accel_disable == true) + { + event_log_info (hashcat_ctx, "* --multiply-accel-disable"); + } + if (user_options->backend_vector_width_chgd == true) { event_log_info (hashcat_ctx, "* --backend-vector-width=%u", user_options->backend_vector_width); @@ -2040,6 +2048,11 @@ void user_options_info (hashcat_ctx_t *hashcat_ctx) event_log_info (hashcat_ctx, "# option: --optimized-kernel-enable"); } + if (user_options->multiply_accel_disable == true) + { + event_log_info (hashcat_ctx, "# option: --multiply-accel-disable"); + } + if (user_options->backend_vector_width_chgd == true) { event_log_info (hashcat_ctx, "# option: --backend-vector-width=%u", user_options->backend_vector_width); @@ -3078,6 +3091,7 @@ void user_options_logger (hashcat_ctx_t *hashcat_ctx) logfile_top_uint (user_options->markov_disable); logfile_top_uint (user_options->markov_inverse); logfile_top_uint (user_options->markov_threshold); + logfile_top_uint (user_options->multiply_accel_disable); logfile_top_uint (user_options->backend_info); logfile_top_uint (user_options->backend_vector_width); logfile_top_uint (user_options->optimized_kernel_enable);