mirror of
https://github.com/hashcat/hashcat.git
synced 2025-04-02 07:45:53 +00:00
Avoid unnecessary memcpy in check_hash()
This commit is contained in:
parent
43a3622a77
commit
73b8cda176
12
src/hashes.c
12
src/hashes.c
@ -346,6 +346,7 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
|
|||||||
// plain
|
// plain
|
||||||
|
|
||||||
u8 plain_buf[HCBUFSIZ_TINY] = { 0 }; // while the password itself can have only length 256, the module could encode it with something like base64 which inflates the requires buffer size
|
u8 plain_buf[HCBUFSIZ_TINY] = { 0 }; // while the password itself can have only length 256, the module could encode it with something like base64 which inflates the requires buffer size
|
||||||
|
u8 postprocess_buf[HCBUFSIZ_TINY] = { 0 };
|
||||||
|
|
||||||
u8 *plain_ptr = plain_buf;
|
u8 *plain_ptr = plain_buf;
|
||||||
|
|
||||||
@ -355,8 +356,6 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
|
|||||||
|
|
||||||
if (module_ctx->module_build_plain_postprocess != MODULE_DEFAULT)
|
if (module_ctx->module_build_plain_postprocess != MODULE_DEFAULT)
|
||||||
{
|
{
|
||||||
u8 temp_buf[HCBUFSIZ_TINY] = { 0 };
|
|
||||||
|
|
||||||
if (hashconfig->opts_type & OPTS_TYPE_COPY_TMPS)
|
if (hashconfig->opts_type & OPTS_TYPE_COPY_TMPS)
|
||||||
{
|
{
|
||||||
if (device_param->is_cuda == true)
|
if (device_param->is_cuda == true)
|
||||||
@ -375,14 +374,9 @@ void check_hash (hashcat_ctx_t *hashcat_ctx, hc_device_param_t *device_param, pl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const int temp_len = module_ctx->module_build_plain_postprocess (hashcat_ctx->hashconfig, hashcat_ctx->hashes, tmps, (u32 *) plain_buf, sizeof (plain_buf), plain_len, (u32 *)temp_buf, sizeof (temp_buf));
|
plain_len = module_ctx->module_build_plain_postprocess (hashcat_ctx->hashconfig, hashcat_ctx->hashes, tmps, (u32 *) plain_buf, sizeof (plain_buf), plain_len, (u32 *) postprocess_buf, sizeof (postprocess_buf));
|
||||||
|
|
||||||
if (temp_len < (int) sizeof (plain_buf))
|
plain_ptr = postprocess_buf;
|
||||||
{
|
|
||||||
memcpy (plain_buf, temp_buf, temp_len);
|
|
||||||
|
|
||||||
plain_len = temp_len;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// crackpos
|
// crackpos
|
||||||
|
Loading…
Reference in New Issue
Block a user