1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-11-29 11:28:15 +00:00

Unit-Tests: Added missing support for OPTS_TYPE_LOOP_PREPARE, OPTS_TYPE_LOOP_PREPARE2 and salt_repeats in self-test

This commit is contained in:
Jens Steube 2021-06-11 18:36:19 +02:00
parent 388e0a1c7e
commit 51fe320425
2 changed files with 66 additions and 44 deletions

View File

@ -65,6 +65,7 @@
- Modules: Recategorized HASH_CATEGORY option in various modules - Modules: Recategorized HASH_CATEGORY option in various modules
- Modules: Added hash categories HASH_CATEGORY_IMS and HASH_CATEGORY_CRYPTOCURRENCY_WALLET - Modules: Added hash categories HASH_CATEGORY_IMS and HASH_CATEGORY_CRYPTOCURRENCY_WALLET
- Modules: Changed hash category of Python passlib from HASH_CATEGORY_GENERIC_KDF to HASH_CATEGORY_FRAMEWORK - Modules: Changed hash category of Python passlib from HASH_CATEGORY_GENERIC_KDF to HASH_CATEGORY_FRAMEWORK
- Unit-Tests: Added missing support for OPTS_TYPE_LOOP_PREPARE, OPTS_TYPE_LOOP_PREPARE2 and salt_repeats in self-test
- Unit-Tests: Added missing unit-test for Stargazer Stellar Wallet XLM - Unit-Tests: Added missing unit-test for Stargazer Stellar Wallet XLM
* changes v6.2.0 -> v6.2.1 * changes v6.2.0 -> v6.2.1

View File

@ -481,11 +481,22 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
} }
} }
const u32 loop_step = hashconfig->kernel_loops_min + ((hashconfig->kernel_loops_max - hashconfig->kernel_loops_min) / 32);
const u32 salt_pos = 0; const u32 salt_pos = 0;
salt_t *salt_buf = &hashes->st_salts_buf[salt_pos]; salt_t *salt_buf = &hashes->st_salts_buf[salt_pos];
const u32 loop_step = hashconfig->kernel_loops_min + ((hashconfig->kernel_loops_max - hashconfig->kernel_loops_min) / 32); const u32 salt_repeats = hashes->salts_buf[salt_pos].salt_repeats;
for (u32 salt_repeat = 0; salt_repeat <= salt_repeats; salt_repeat++)
{
device_param->kernel_params_buf32[34] = salt_repeat;
if (hashconfig->opts_type & OPTS_TYPE_LOOP_PREPARE)
{
if (run_kernel (hashcat_ctx, device_param, KERN_RUN_2P, 0, 1, false, 0) == -1) return -1;
}
const u32 iter = salt_buf->salt_iter; const u32 iter = salt_buf->salt_iter;
@ -532,12 +543,22 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_TRUE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1; if (hc_clEnqueueWriteBuffer (hashcat_ctx, device_param->opencl_command_queue, device_param->opencl_d_hooks, CL_TRUE, 0, device_param->size_hooks, device_param->hooks_buf, 0, NULL, NULL) == -1) return -1;
} }
} }
}
if (hashconfig->opts_type & OPTS_TYPE_INIT2) if (hashconfig->opts_type & OPTS_TYPE_INIT2)
{ {
if (run_kernel (hashcat_ctx, device_param, KERN_RUN_INIT2, 0, 1, false, 0) == -1) return -1; if (run_kernel (hashcat_ctx, device_param, KERN_RUN_INIT2, 0, 1, false, 0) == -1) return -1;
} }
for (u32 salt_repeat = 0; salt_repeat <= salt_repeats; salt_repeat++)
{
device_param->kernel_params_buf32[34] = salt_repeat;
if (hashconfig->opts_type & OPTS_TYPE_LOOP2_PREPARE)
{
if (run_kernel (hashcat_ctx, device_param, KERN_RUN_LOOP2P, 0, 1, false, 0) == -1) return -1;
}
if (hashconfig->opts_type & OPTS_TYPE_LOOP2) if (hashconfig->opts_type & OPTS_TYPE_LOOP2)
{ {
const u32 iter2 = salt_buf->salt_iter2; const u32 iter2 = salt_buf->salt_iter2;
@ -554,6 +575,7 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
if (run_kernel (hashcat_ctx, device_param, KERN_RUN_LOOP2, 0, 1, false, 0) == -1) return -1; if (run_kernel (hashcat_ctx, device_param, KERN_RUN_LOOP2, 0, 1, false, 0) == -1) return -1;
} }
} }
}
if (hashconfig->opts_type & OPTS_TYPE_DEEP_COMP_KERNEL) if (hashconfig->opts_type & OPTS_TYPE_DEEP_COMP_KERNEL)
{ {
@ -602,14 +624,13 @@ static int selftest (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param
// finish : cleanup and restore // finish : cleanup and restore
device_param->kernel_params_buf32[27] = 0;
device_param->kernel_params_buf32[28] = 0; device_param->kernel_params_buf32[28] = 0;
device_param->kernel_params_buf32[29] = 0; device_param->kernel_params_buf32[29] = 0;
device_param->kernel_params_buf32[30] = 0; device_param->kernel_params_buf32[30] = 0;
device_param->kernel_params_buf32[31] = 0; device_param->kernel_params_buf32[31] = 0;
device_param->kernel_params_buf32[32] = 0; device_param->kernel_params_buf32[32] = 0;
device_param->kernel_params_buf32[33] = 0; device_param->kernel_params_buf32[33] = 0;
device_param->kernel_params_buf64[34] = 0; device_param->kernel_params_buf32[34] = 0;
if (device_param->is_cuda == true) if (device_param->is_cuda == true)
{ {