|
|
|
@ -23,6 +23,8 @@ static const u64 KERN_TYPE = 22700;
|
|
|
|
|
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE;
|
|
|
|
|
static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_BE
|
|
|
|
|
| OPTS_TYPE_PT_UTF16BE
|
|
|
|
|
| OPTS_TYPE_MP_MULTI_DISABLE
|
|
|
|
|
| OPTS_TYPE_NATIVE_THREADS
|
|
|
|
|
| OPTS_TYPE_SELF_TEST_DISABLE;
|
|
|
|
|
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
|
|
|
|
static const char *ST_PASS = "hashcat";
|
|
|
|
@ -44,15 +46,10 @@ const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig,
|
|
|
|
|
const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; }
|
|
|
|
|
|
|
|
|
|
static const char *SIGNATURE_MULTIBIT = "$multibit$";
|
|
|
|
|
static const u32 SCRYPT_N = 16384;
|
|
|
|
|
static const u32 SCRYPT_R = 8;
|
|
|
|
|
static const u32 SCRYPT_P = 1;
|
|
|
|
|
|
|
|
|
|
// limit scrypt accel otherwise we hurt ourself when calculating the scrypt tmto
|
|
|
|
|
// 16 is actually a bit low, we may need to change this depending on user response
|
|
|
|
|
|
|
|
|
|
static const u32 SCRYPT_MAX_ACCEL = 16;
|
|
|
|
|
static const u32 SCRYPT_MAX_THREADS = 16;
|
|
|
|
|
static const u64 SCRYPT_N = 16384;
|
|
|
|
|
static const u64 SCRYPT_R = 8;
|
|
|
|
|
static const u64 SCRYPT_P = 1;
|
|
|
|
|
|
|
|
|
|
bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hc_device_param_t *device_param)
|
|
|
|
|
{
|
|
|
|
@ -65,20 +62,6 @@ bool module_unstable_warning (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 module_kernel_accel_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
|
|
|
|
{
|
|
|
|
|
const u32 kernel_accel_min = 1;
|
|
|
|
|
|
|
|
|
|
return kernel_accel_min;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 module_kernel_accel_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)
|
|
|
|
|
{
|
|
|
|
|
const u32 kernel_accel_max = (user_options->kernel_accel_chgd == true) ? user_options->kernel_accel : SCRYPT_MAX_ACCEL;
|
|
|
|
|
|
|
|
|
|
return kernel_accel_max;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 module_kernel_loops_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
|
|
|
|
{
|
|
|
|
|
const u32 kernel_loops_min = 1;
|
|
|
|
@ -93,23 +76,6 @@ u32 module_kernel_loops_max (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_
|
|
|
|
|
return kernel_loops_max;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 module_kernel_threads_min (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
|
|
|
|
{
|
|
|
|
|
const u32 kernel_threads_min = 1;
|
|
|
|
|
|
|
|
|
|
return kernel_threads_min;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 module_kernel_threads_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)
|
|
|
|
|
{
|
|
|
|
|
// limit scrypt accel otherwise we hurt ourself when calculating the scrypt tmto
|
|
|
|
|
// 16 is actually a bit low, we may need to change this depending on user response
|
|
|
|
|
|
|
|
|
|
const u32 kernel_threads_max = (user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : SCRYPT_MAX_THREADS;
|
|
|
|
|
|
|
|
|
|
return kernel_threads_max;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
@ -125,15 +91,15 @@ u64 module_extra_buffer_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
|
|
|
|
// we need to set the self-test hash settings to pass the self-test
|
|
|
|
|
// the decoder for the self-test is called after this function
|
|
|
|
|
|
|
|
|
|
const u32 scrypt_N = SCRYPT_N;
|
|
|
|
|
const u32 scrypt_r = SCRYPT_R;
|
|
|
|
|
const u64 scrypt_N = (hashes->salts_buf[0].scrypt_N) ? hashes->salts_buf[0].scrypt_N : SCRYPT_N;
|
|
|
|
|
const u64 scrypt_r = (hashes->salts_buf[0].scrypt_r) ? hashes->salts_buf[0].scrypt_r : SCRYPT_R;
|
|
|
|
|
|
|
|
|
|
const u64 kernel_power_max = (u64)(device_param->device_processors * hashconfig->kernel_threads_max * hashconfig->kernel_accel_max);
|
|
|
|
|
const u64 kernel_power_max = ((OPTS_TYPE & OPTS_TYPE_MP_MULTI_DISABLE) ? 1 : device_param->device_processors) * device_param->kernel_threads_max * device_param->kernel_accel_max;
|
|
|
|
|
|
|
|
|
|
u32 tmto_start = 1;
|
|
|
|
|
u32 tmto_stop = 6;
|
|
|
|
|
u64 tmto_start = 0;
|
|
|
|
|
u64 tmto_stop = 4;
|
|
|
|
|
|
|
|
|
|
if (user_options->scrypt_tmto)
|
|
|
|
|
if (user_options->scrypt_tmto_chgd == true)
|
|
|
|
|
{
|
|
|
|
|
tmto_start = user_options->scrypt_tmto;
|
|
|
|
|
tmto_stop = user_options->scrypt_tmto;
|
|
|
|
@ -189,13 +155,13 @@ u64 module_extra_buffer_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE
|
|
|
|
|
|
|
|
|
|
u64 size_scrypt = 0;
|
|
|
|
|
|
|
|
|
|
u32 tmto;
|
|
|
|
|
u64 tmto;
|
|
|
|
|
|
|
|
|
|
for (tmto = tmto_start; tmto <= tmto_stop; tmto++)
|
|
|
|
|
{
|
|
|
|
|
size_scrypt = (128 * scrypt_r) * scrypt_N;
|
|
|
|
|
size_scrypt = (128ULL * scrypt_r) * scrypt_N;
|
|
|
|
|
|
|
|
|
|
size_scrypt /= 1u << tmto;
|
|
|
|
|
size_scrypt /= 1ull << tmto;
|
|
|
|
|
|
|
|
|
|
size_scrypt *= kernel_power_max;
|
|
|
|
|
|
|
|
|
@ -222,13 +188,23 @@ u64 module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED c
|
|
|
|
|
|
|
|
|
|
u64 module_extra_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes)
|
|
|
|
|
{
|
|
|
|
|
// we need to set the self-test hash settings to pass the self-test
|
|
|
|
|
// the decoder for the self-test is called after this function
|
|
|
|
|
const u64 scrypt_N = (hashes->salts_buf[0].scrypt_N) ? hashes->salts_buf[0].scrypt_N : SCRYPT_N;
|
|
|
|
|
const u64 scrypt_r = (hashes->salts_buf[0].scrypt_r) ? hashes->salts_buf[0].scrypt_r : SCRYPT_R;
|
|
|
|
|
const u64 scrypt_p = (hashes->salts_buf[0].scrypt_p) ? hashes->salts_buf[0].scrypt_p : SCRYPT_P;
|
|
|
|
|
|
|
|
|
|
const u32 scrypt_r = SCRYPT_R;
|
|
|
|
|
const u32 scrypt_p = SCRYPT_P;
|
|
|
|
|
// we need to check that all hashes have the same scrypt settings
|
|
|
|
|
|
|
|
|
|
const u64 tmp_size = (u64)(128 * scrypt_r * scrypt_p);
|
|
|
|
|
for (u32 i = 1; i < hashes->salts_cnt; i++)
|
|
|
|
|
{
|
|
|
|
|
if ((hashes->salts_buf[i].scrypt_N != scrypt_N)
|
|
|
|
|
|| (hashes->salts_buf[i].scrypt_r != scrypt_r)
|
|
|
|
|
|| (hashes->salts_buf[i].scrypt_p != scrypt_p))
|
|
|
|
|
{
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const u64 tmp_size = 128ULL * scrypt_r * scrypt_p;
|
|
|
|
|
|
|
|
|
|
return tmp_size;
|
|
|
|
|
}
|
|
|
|
@ -238,28 +214,33 @@ bool module_jit_cache_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYB
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool module_warmup_disable (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra, MAYBE_UNUSED const hashes_t *hashes, MAYBE_UNUSED const hc_device_param_t *device_param)
|
|
|
|
|
{
|
|
|
|
|
const u32 scrypt_N = SCRYPT_N;
|
|
|
|
|
const u32 scrypt_r = SCRYPT_R;
|
|
|
|
|
const u32 scrypt_p = SCRYPT_P;
|
|
|
|
|
const u64 scrypt_N = (hashes->salts_buf[0].scrypt_N) ? hashes->salts_buf[0].scrypt_N : SCRYPT_N;
|
|
|
|
|
const u64 scrypt_r = (hashes->salts_buf[0].scrypt_r) ? hashes->salts_buf[0].scrypt_r : SCRYPT_R;
|
|
|
|
|
const u64 scrypt_p = (hashes->salts_buf[0].scrypt_p) ? hashes->salts_buf[0].scrypt_p : SCRYPT_P;
|
|
|
|
|
|
|
|
|
|
const u64 extra_buffer_size = device_param->extra_buffer_size;
|
|
|
|
|
|
|
|
|
|
const u64 kernel_power_max = (u64)(device_param->device_processors * hashconfig->kernel_threads_max * hashconfig->kernel_accel_max);
|
|
|
|
|
const u64 kernel_power_max = ((OPTS_TYPE & OPTS_TYPE_MP_MULTI_DISABLE) ? 1 : device_param->device_processors) * device_param->kernel_threads_max * device_param->kernel_accel_max;
|
|
|
|
|
|
|
|
|
|
const u64 size_scrypt = (u64)(128 * scrypt_r * scrypt_N);
|
|
|
|
|
const u64 size_scrypt = 128ULL * scrypt_r * scrypt_N;
|
|
|
|
|
|
|
|
|
|
const u64 scrypt_tmto_final = (kernel_power_max * size_scrypt) / extra_buffer_size;
|
|
|
|
|
|
|
|
|
|
const u64 tmp_size = (u64)(128 * scrypt_r * scrypt_p);
|
|
|
|
|
const u64 tmp_size = 128ULL * scrypt_r * scrypt_p;
|
|
|
|
|
|
|
|
|
|
char *jit_build_options = NULL;
|
|
|
|
|
|
|
|
|
|
hc_asprintf (&jit_build_options, "-DSCRYPT_N=%u -DSCRYPT_R=%u -DSCRYPT_P=%u -DSCRYPT_TMTO=%" PRIu64 " -DSCRYPT_TMP_ELEM=%" PRIu64,
|
|
|
|
|
SCRYPT_N,
|
|
|
|
|
SCRYPT_R,
|
|
|
|
|
SCRYPT_P,
|
|
|
|
|
hashes->salts_buf[0].scrypt_N,
|
|
|
|
|
hashes->salts_buf[0].scrypt_r,
|
|
|
|
|
hashes->salts_buf[0].scrypt_p,
|
|
|
|
|
scrypt_tmto_final,
|
|
|
|
|
tmp_size / 16);
|
|
|
|
|
|
|
|
|
@ -427,12 +408,12 @@ void module_init (module_ctx_t *module_ctx)
|
|
|
|
|
module_ctx->module_hook_size = MODULE_DEFAULT;
|
|
|
|
|
module_ctx->module_jit_build_options = module_jit_build_options;
|
|
|
|
|
module_ctx->module_jit_cache_disable = module_jit_cache_disable;
|
|
|
|
|
module_ctx->module_kernel_accel_max = module_kernel_accel_max;
|
|
|
|
|
module_ctx->module_kernel_accel_min = module_kernel_accel_min;
|
|
|
|
|
module_ctx->module_kernel_accel_max = MODULE_DEFAULT;
|
|
|
|
|
module_ctx->module_kernel_accel_min = MODULE_DEFAULT;
|
|
|
|
|
module_ctx->module_kernel_loops_max = module_kernel_loops_max;
|
|
|
|
|
module_ctx->module_kernel_loops_min = module_kernel_loops_min;
|
|
|
|
|
module_ctx->module_kernel_threads_max = module_kernel_threads_max;
|
|
|
|
|
module_ctx->module_kernel_threads_min = module_kernel_threads_min;
|
|
|
|
|
module_ctx->module_kernel_threads_max = MODULE_DEFAULT;
|
|
|
|
|
module_ctx->module_kernel_threads_min = MODULE_DEFAULT;
|
|
|
|
|
module_ctx->module_kern_type = module_kern_type;
|
|
|
|
|
module_ctx->module_kern_type_dynamic = MODULE_DEFAULT;
|
|
|
|
|
module_ctx->module_opti_type = module_opti_type;
|
|
|
|
@ -453,5 +434,5 @@ void module_init (module_ctx_t *module_ctx)
|
|
|
|
|
module_ctx->module_st_pass = module_st_pass;
|
|
|
|
|
module_ctx->module_tmp_size = module_tmp_size;
|
|
|
|
|
module_ctx->module_unstable_warning = module_unstable_warning;
|
|
|
|
|
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
|
|
|
|
module_ctx->module_warmup_disable = module_warmup_disable;
|
|
|
|
|
}
|
|
|
|
|