From 8c54727a8c780eab017528e63d3e2cfdbfe157a9 Mon Sep 17 00:00:00 2001 From: philsmd Date: Sat, 27 Jun 2020 12:48:36 +0200 Subject: [PATCH] updates default pw_max length for blake2b --- src/modules/module_00600.c | 16 ++++++++++++++-- tools/test_modules/m00600.pm | 2 +- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/modules/module_00600.c b/src/modules/module_00600.c index 32e5a6550..c22fbde3a 100644 --- a/src/modules/module_00600.c +++ b/src/modules/module_00600.c @@ -23,7 +23,7 @@ static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE | OPTI_TYPE_USES_BITS_64 | OPTI_TYPE_RAW_HASH; static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE; -static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED; +static const u32 SALT_TYPE = SALT_TYPE_NONE; static const char *ST_PASS = "hashcat"; static const char *ST_HASH = "$BLAKE2$296c269e70ac5f0095e6fb47693480f0f7b97ccd0307f5c3bfa4df8f5ca5c9308a0e7108e80a0a9c0ebb715e8b7109b072046c6cd5e155b4cfd2f27216283b1e"; @@ -44,6 +44,18 @@ const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, static const char *SIGNATURE_BLAKE2B = "$BLAKE2$"; +u32 module_pw_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) +{ + // this overrides the reductions of pw_max in case optimized kernel is selected + // IOW, even in optimized kernel mode it support length 64 + + const bool optimized_kernel = (hashconfig->opti_type & OPTI_TYPE_OPTIMIZED_KERNEL); + + const u32 pw_max = (optimized_kernel == true) ? 64 : PW_MAX; + + return pw_max; +} + int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED void *digest_buf, MAYBE_UNUSED salt_t *salt, MAYBE_UNUSED void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t *hash_info, const char *line_buf, MAYBE_UNUSED const int line_len) { u64 *digest = (u64 *) digest_buf; @@ -166,7 +178,7 @@ void module_init (module_ctx_t *module_ctx) module_ctx->module_potfile_disable = MODULE_DEFAULT; module_ctx->module_potfile_keep_all_hashes = MODULE_DEFAULT; module_ctx->module_pwdump_column = MODULE_DEFAULT; - module_ctx->module_pw_max = MODULE_DEFAULT; + module_ctx->module_pw_max = module_pw_max; module_ctx->module_pw_min = MODULE_DEFAULT; module_ctx->module_salt_max = MODULE_DEFAULT; module_ctx->module_salt_min = MODULE_DEFAULT; diff --git a/tools/test_modules/m00600.pm b/tools/test_modules/m00600.pm index 8d1883470..a0553f762 100644 --- a/tools/test_modules/m00600.pm +++ b/tools/test_modules/m00600.pm @@ -10,7 +10,7 @@ use warnings; use Digest::BLAKE2 qw (blake2b_hex); -sub module_constraints { [[0, 256], [-1, -1], [0, 55], [-1, -1], [-1, -1]] } +sub module_constraints { [[0, 256], [-1, -1], [0, 64], [-1, -1], [-1, -1]] } sub module_generate_hash {