mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-08 15:48:15 +00:00
Re-enable warmup on SCRYPT based algorithms for more accurate results.
Fix TMTO handling
This commit is contained in:
parent
07395626fa
commit
4d2485db0f
@ -291,7 +291,7 @@ DECLSPEC void scrypt_smix_init (LOCAL_AS uint4 *X, GLOBAL_AS uint4 *V0, GLOBAL_A
|
||||
DECLSPEC void scrypt_smix_init (PRIVATE_AS uint4 *X, GLOBAL_AS uint4 *V0, GLOBAL_AS uint4 *V1, GLOBAL_AS uint4 *V2, GLOBAL_AS uint4 *V3, const u64 gid)
|
||||
#endif
|
||||
{
|
||||
const u32 ySIZE = SCRYPT_N / SCRYPT_TMTO;
|
||||
const u32 ySIZE = SCRYPT_N >> SCRYPT_TMTO;
|
||||
const u32 zSIZE = STATE_CNT4;
|
||||
|
||||
const u32 x = (u32) gid;
|
||||
@ -314,9 +314,9 @@ DECLSPEC void scrypt_smix_init (PRIVATE_AS uint4 *X, GLOBAL_AS uint4 *V0, GLOBAL
|
||||
for (u32 z = 0; z < zSIZE; z++) V[CO] = X[z];
|
||||
|
||||
#ifdef IS_HIP
|
||||
for (u32 i = 0; i < SCRYPT_TMTO; i++) salsa_r_l ((LOCAL_AS u32 *) X);
|
||||
for (u32 i = 0; i < (1 << SCRYPT_TMTO); i++) salsa_r_l ((LOCAL_AS u32 *) X);
|
||||
#else
|
||||
for (u32 i = 0; i < SCRYPT_TMTO; i++) salsa_r_p ((PRIVATE_AS u32 *) X);
|
||||
for (u32 i = 0; i < (1 << SCRYPT_TMTO); i++) salsa_r_p ((PRIVATE_AS u32 *) X);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@ -327,7 +327,7 @@ DECLSPEC void scrypt_smix_loop (PRIVATE_AS uint4 *X, LOCAL_AS uint4 *T, GLOBAL_A
|
||||
DECLSPEC void scrypt_smix_loop (PRIVATE_AS uint4 *X, PRIVATE_AS uint4 *T, GLOBAL_AS uint4 *V0, GLOBAL_AS uint4 *V1, GLOBAL_AS uint4 *V2, GLOBAL_AS uint4 *V3, const u64 gid)
|
||||
#endif
|
||||
{
|
||||
const u32 ySIZE = SCRYPT_N / SCRYPT_TMTO;
|
||||
const u32 ySIZE = SCRYPT_N >> SCRYPT_TMTO;
|
||||
const u32 zSIZE = STATE_CNT4;
|
||||
|
||||
const u32 x = (u32) gid;
|
||||
@ -351,9 +351,9 @@ DECLSPEC void scrypt_smix_loop (PRIVATE_AS uint4 *X, PRIVATE_AS uint4 *T, GLOBAL
|
||||
{
|
||||
const u32 k = X[zSIZE - 4].x & (SCRYPT_N - 1);
|
||||
|
||||
const u32 y = k / SCRYPT_TMTO;
|
||||
const u32 y = k >> SCRYPT_TMTO;
|
||||
|
||||
const u32 km = k - (y * SCRYPT_TMTO);
|
||||
const u32 km = k - (y << SCRYPT_TMTO);
|
||||
|
||||
for (u32 z = 0; z < zSIZE; z++) T[z] = V[CO];
|
||||
|
||||
|
@ -247,5 +247,5 @@ void module_init (module_ctx_t *module_ctx)
|
||||
module_ctx->module_st_pass = module_st_pass;
|
||||
module_ctx->module_tmp_size = scrypt_module_tmp_size;
|
||||
module_ctx->module_unstable_warning = MODULE_DEFAULT;
|
||||
module_ctx->module_warmup_disable = scrypt_module_warmup_disable;
|
||||
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
||||
}
|
||||
|
@ -209,5 +209,5 @@ void module_init (module_ctx_t *module_ctx)
|
||||
module_ctx->module_st_pass = module_st_pass;
|
||||
module_ctx->module_tmp_size = scrypt_module_tmp_size;
|
||||
module_ctx->module_unstable_warning = MODULE_DEFAULT;
|
||||
module_ctx->module_warmup_disable = scrypt_module_warmup_disable;
|
||||
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
||||
}
|
||||
|
@ -308,5 +308,5 @@ void module_init (module_ctx_t *module_ctx)
|
||||
module_ctx->module_st_pass = module_st_pass;
|
||||
module_ctx->module_tmp_size = scrypt_module_tmp_size;
|
||||
module_ctx->module_unstable_warning = MODULE_DEFAULT;
|
||||
module_ctx->module_warmup_disable = scrypt_module_warmup_disable;
|
||||
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
||||
}
|
||||
|
@ -246,5 +246,5 @@ void module_init (module_ctx_t *module_ctx)
|
||||
module_ctx->module_st_pass = module_st_pass;
|
||||
module_ctx->module_tmp_size = scrypt_module_tmp_size;
|
||||
module_ctx->module_unstable_warning = MODULE_DEFAULT;
|
||||
module_ctx->module_warmup_disable = scrypt_module_warmup_disable;
|
||||
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
||||
}
|
||||
|
@ -263,5 +263,5 @@ void module_init (module_ctx_t *module_ctx)
|
||||
module_ctx->module_st_pass = module_st_pass;
|
||||
module_ctx->module_tmp_size = scrypt_module_tmp_size;
|
||||
module_ctx->module_unstable_warning = MODULE_DEFAULT;
|
||||
module_ctx->module_warmup_disable = scrypt_module_warmup_disable;
|
||||
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
||||
}
|
||||
|
@ -270,5 +270,5 @@ void module_init (module_ctx_t *module_ctx)
|
||||
module_ctx->module_st_pass = module_st_pass;
|
||||
module_ctx->module_tmp_size = scrypt_module_tmp_size;
|
||||
module_ctx->module_unstable_warning = MODULE_DEFAULT;
|
||||
module_ctx->module_warmup_disable = scrypt_module_warmup_disable;
|
||||
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
||||
}
|
||||
|
@ -366,5 +366,5 @@ void module_init (module_ctx_t *module_ctx)
|
||||
module_ctx->module_st_pass = module_st_pass;
|
||||
module_ctx->module_tmp_size = scrypt_module_tmp_size;
|
||||
module_ctx->module_unstable_warning = MODULE_DEFAULT;
|
||||
module_ctx->module_warmup_disable = scrypt_module_warmup_disable;
|
||||
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
||||
}
|
||||
|
@ -277,5 +277,5 @@ void module_init (module_ctx_t *module_ctx)
|
||||
module_ctx->module_st_pass = module_st_pass;
|
||||
module_ctx->module_tmp_size = scrypt_module_tmp_size;
|
||||
module_ctx->module_unstable_warning = MODULE_DEFAULT;
|
||||
module_ctx->module_warmup_disable = scrypt_module_warmup_disable;
|
||||
module_ctx->module_warmup_disable = MODULE_DEFAULT;
|
||||
}
|
||||
|
@ -57,9 +57,9 @@ const char *scrypt_module_extra_tuningdb_block (MAYBE_UNUSED const hashconfig_t
|
||||
|
||||
// we enforce the same configuration for all hashes, so the next lines should be fine
|
||||
|
||||
const u32 scrypt_N = hashes->salts_buf[0].scrypt_N;
|
||||
const u32 scrypt_r = hashes->salts_buf[0].scrypt_r;
|
||||
const u32 scrypt_p = hashes->salts_buf[0].scrypt_p;
|
||||
const u32 scrypt_N = (hashes->salts_buf[0].scrypt_N == 0) ? hashes->st_salts_buf[0].scrypt_N : hashes->salts_buf[0].scrypt_N;
|
||||
const u32 scrypt_r = (hashes->salts_buf[0].scrypt_r == 0) ? hashes->st_salts_buf[0].scrypt_r : hashes->salts_buf[0].scrypt_r;
|
||||
const u32 scrypt_p = (hashes->salts_buf[0].scrypt_p == 0) ? hashes->st_salts_buf[0].scrypt_p : hashes->salts_buf[0].scrypt_p;
|
||||
|
||||
const u64 size_per_accel = (128ULL * scrypt_r * scrypt_N * scrypt_exptected_threads (hashconfig, user_options, user_options_extra, device_param)) >> tmto;
|
||||
const u64 state_per_accel = (128ULL * scrypt_r * scrypt_p * scrypt_exptected_threads (hashconfig, user_options, user_options_extra, device_param));
|
||||
@ -179,9 +179,9 @@ u64 scrypt_module_extra_buffer_size (MAYBE_UNUSED const hashconfig_t *hashconfig
|
||||
// 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 = hashes->salts_buf[0].scrypt_N;
|
||||
const u32 scrypt_r = hashes->salts_buf[0].scrypt_r;
|
||||
//const u32 scrypt_p = hashes->salts_buf[0].scrypt_p;
|
||||
const u32 scrypt_N = (hashes->salts_buf[0].scrypt_N == 0) ? hashes->st_salts_buf[0].scrypt_N : hashes->salts_buf[0].scrypt_N;
|
||||
const u32 scrypt_r = (hashes->salts_buf[0].scrypt_r == 0) ? hashes->st_salts_buf[0].scrypt_r : hashes->salts_buf[0].scrypt_r;
|
||||
//const u32 scrypt_p = (hashes->salts_buf[0].scrypt_p == 0) ? hashes->st_salts_buf[0].scrypt_p : hashes->salts_buf[0].scrypt_p;
|
||||
|
||||
const u64 size_per_accel = 128ULL * scrypt_r * scrypt_N * scrypt_exptected_threads (hashconfig, user_options, user_options_extra, device_param);
|
||||
|
||||
@ -207,9 +207,9 @@ u64 scrypt_module_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_U
|
||||
|
||||
u64 scrypt_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)
|
||||
{
|
||||
const u32 scrypt_N = hashes->salts_buf[0].scrypt_N;
|
||||
const u32 scrypt_r = hashes->salts_buf[0].scrypt_r;
|
||||
const u32 scrypt_p = hashes->salts_buf[0].scrypt_p;
|
||||
const u32 scrypt_N = (hashes->salts_buf[0].scrypt_N == 0) ? hashes->st_salts_buf[0].scrypt_N : hashes->salts_buf[0].scrypt_N;
|
||||
const u32 scrypt_r = (hashes->salts_buf[0].scrypt_r == 0) ? hashes->st_salts_buf[0].scrypt_r : hashes->salts_buf[0].scrypt_r;
|
||||
const u32 scrypt_p = (hashes->salts_buf[0].scrypt_p == 0) ? hashes->st_salts_buf[0].scrypt_p : hashes->salts_buf[0].scrypt_p;
|
||||
|
||||
// in general, since we compile the kernel based on N, r, p, so the JIT can optimize it, we can't have other configuration settings
|
||||
// we need to check that all hashes have the same scrypt settings
|
||||
@ -241,16 +241,11 @@ u64 scrypt_module_extra_tmp_size (MAYBE_UNUSED const hashconfig_t *hashconfig, M
|
||||
return tmp_size;
|
||||
}
|
||||
|
||||
bool scrypt_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 *scrypt_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 = hashes->salts_buf[0].scrypt_N;
|
||||
const u32 scrypt_r = hashes->salts_buf[0].scrypt_r;
|
||||
const u32 scrypt_p = hashes->salts_buf[0].scrypt_p;
|
||||
const u32 scrypt_N = (hashes->salts_buf[0].scrypt_N == 0) ? hashes->st_salts_buf[0].scrypt_N : hashes->salts_buf[0].scrypt_N;
|
||||
const u32 scrypt_r = (hashes->salts_buf[0].scrypt_r == 0) ? hashes->st_salts_buf[0].scrypt_r : hashes->salts_buf[0].scrypt_r;
|
||||
const u32 scrypt_p = (hashes->salts_buf[0].scrypt_p == 0) ? hashes->st_salts_buf[0].scrypt_p : hashes->salts_buf[0].scrypt_p;
|
||||
|
||||
const u64 tmp_size = 128ULL * scrypt_r * scrypt_p;
|
||||
|
||||
@ -260,7 +255,7 @@ char *scrypt_module_jit_build_options (MAYBE_UNUSED const hashconfig_t *hashconf
|
||||
scrypt_N,
|
||||
scrypt_r,
|
||||
scrypt_p,
|
||||
tmto + 1,
|
||||
tmto,
|
||||
tmp_size / 16);
|
||||
|
||||
return jit_build_options;
|
||||
|
Loading…
Reference in New Issue
Block a user