mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-09 16:18:19 +00:00
Merge pull request #4250 from matrix/update_chksum_format
Backend: Updated filename chksum format to prevent invalid cache on Apple Silicon when switching arch
This commit is contained in:
commit
30c7c90635
@ -119,6 +119,7 @@
|
||||
- AMD Driver: Updated requirements for AMD Windows drivers to "AMD Adrenalin Edition" (23.7.2 or later) and "AMD HIP SDK" (23.Q3 or later)
|
||||
- Apple Driver: Automatically enable GPU support on Apple OpenCL instead of CPU support
|
||||
- Apple Driver: Updated requirements to use Apple OpenCL API to macOS 13.0 - use
|
||||
- Backend: Updated filename chksum format to prevent invalid cache on Apple Silicon when switching arch
|
||||
- Backend Checks: Describe workaround in error message when detecting more than 64 backend devices
|
||||
- Brain: Added sanity check and corresponding error message for invalid --brain-port values
|
||||
- Dependencies: Added sse2neon v1.8.0 (commit 658eeac)
|
||||
|
@ -106,6 +106,8 @@ int input_tokenizer (const u8 *input_buf, const int input_len, hc_token_t *token
|
||||
|
||||
int extract_dynamicx_hash (const u8 *input_buf, const int input_len, u8 **output_buf, int *output_len);
|
||||
|
||||
int get_current_arch();
|
||||
|
||||
#if defined (__APPLE__)
|
||||
bool is_apple_silicon (void);
|
||||
#endif
|
||||
|
@ -10528,7 +10528,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
char device_name_chksum_amp_mp[HCBUFSIZ_TINY] = { 0 };
|
||||
|
||||
const size_t dnclen_amp_mp = snprintf (device_name_chksum_amp_mp, HCBUFSIZ_TINY, "%d-%d-%d-%u-%d-%u-%s-%s-%s-%u",
|
||||
const size_t dnclen_amp_mp = snprintf (device_name_chksum_amp_mp, HCBUFSIZ_TINY, "%d-%d-%d-%u-%d-%u-%s-%s-%s-%u-%u",
|
||||
backend_ctx->comptime,
|
||||
backend_ctx->cuda_driver_version,
|
||||
backend_ctx->hip_runtimeVersion,
|
||||
@ -10538,7 +10538,8 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
device_param->device_name,
|
||||
device_param->opencl_device_version,
|
||||
device_param->opencl_driver_version,
|
||||
(user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : device_param->kernel_threads_max);
|
||||
(user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : device_param->kernel_threads_max,
|
||||
get_current_arch());
|
||||
|
||||
md5_ctx_t md5_ctx;
|
||||
|
||||
@ -11090,7 +11091,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
const u32 extra_value = (user_options->attack_mode == ATTACK_MODE_ASSOCIATION) ? ATTACK_MODE_ASSOCIATION : ATTACK_MODE_NONE;
|
||||
|
||||
const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY, "%d-%d-%d-%u-%d-%u-%s-%s-%s-%d-%u-%u-%u-%s",
|
||||
const size_t dnclen = snprintf (device_name_chksum, HCBUFSIZ_TINY, "%d-%d-%d-%u-%d-%u-%s-%s-%s-%d-%u-%u-%u-%u-%s",
|
||||
backend_ctx->comptime,
|
||||
backend_ctx->cuda_driver_version,
|
||||
backend_ctx->hip_runtimeVersion,
|
||||
@ -11104,6 +11105,7 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
hashconfig->kern_type,
|
||||
extra_value,
|
||||
(user_options->kernel_threads_chgd == true) ? user_options->kernel_threads : device_param->kernel_threads_max,
|
||||
get_current_arch(),
|
||||
build_options_module_buf);
|
||||
|
||||
memset (&md5_ctx, 0, sizeof (md5_ctx_t));
|
||||
|
37
src/shared.c
37
src/shared.c
@ -23,6 +23,11 @@
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MSYS__)
|
||||
#else
|
||||
#include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
static const char *const PA_000 = "OK";
|
||||
static const char *const PA_001 = "Ignored due to comment";
|
||||
static const char *const PA_002 = "Ignored due to zero length";
|
||||
@ -1455,6 +1460,38 @@ int generic_salt_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, const u8 *
|
||||
return tmp_len;
|
||||
}
|
||||
|
||||
int get_current_arch()
|
||||
{
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MSYS__)
|
||||
|
||||
SYSTEM_INFO sysinfo;
|
||||
|
||||
GetNativeSystemInfo(&sysinfo);
|
||||
|
||||
switch (sysinfo.wProcessorArchitecture)
|
||||
{
|
||||
case PROCESSOR_ARCHITECTURE_AMD64: return 1;
|
||||
case PROCESSOR_ARCHITECTURE_INTEL: return 2;
|
||||
case PROCESSOR_ARCHITECTURE_ARM64: return 3;
|
||||
case PROCESSOR_ARCHITECTURE_ARM: return 4;
|
||||
default: return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
struct utsname uts;
|
||||
|
||||
if (uname(&uts) != 0) return 0; // same as default, it doesn't matter if it fails here
|
||||
|
||||
if (strstr(uts.machine, "x86_64")) return 1;
|
||||
else if (strstr(uts.machine, "i386") || strstr(uts.machine, "i686")) return 2;
|
||||
else if (strstr(uts.machine, "aarch64") || strstr(uts.machine, "arm64")) return 3;
|
||||
else if (strstr(uts.machine, "arm")) return 4;
|
||||
else return 0;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined (__APPLE__)
|
||||
|
||||
bool is_apple_silicon (void)
|
||||
|
Loading…
Reference in New Issue
Block a user