mirror of
https://github.com/hashcat/hashcat.git
synced 2025-07-06 06:42:35 +00:00

General: The logic for calculating the SCRYPT workload has been moved from module_extra_buffer_size() to module_extra_tuningdb_block(). Previously, this function just returned values from a static tuning file. Now, it actually computes tuning values on the fly based on the device's resources and SCRYPT parameters. This was always possible, it just wasn't used that way until now. After running the calculation, the calculated kernel_accel value is injected into the tuning database as if it had come from a file. The tmto value is stored internally. Users can still override kernel-threads, kernel-accel, and scrypt-tmto via the command line or via tuningdb file. module_extra_tuningdb_block(): This is now where kernel_accel and tmto are automatically calculated. The logic for accel and tmto is now separated and more flexible. Whether the user is using defaults, tuningdb entries, or manual command line overrides, the code logic will try to make smart choices based on what's actually available on the device. First, it tries to find a kernel_accel value that fits into available memory. It starts with a base value and simulates tmto=1 or 2 (which is typical good on GPU). It also leaves room for other buffers (like pws[], tmps[], etc.). If the result is close to the actual processor count, it gets clamped. This value is then added to the tuning database, so hashcat can pick it up during startup. Once that's set, it derives tmto using available memory, thread count, and the actual SCRYPT parameters. module_extra_buffer_size(): This function now just returns the size of the SCRYPT B[] buffer, based on the tmto that was already calculated. kernel_threads: Defaults are now set to 32 threads in most cases. On AMD GPUs, 64 threads might give a slight performance bump, but 32 is more consistent and reliable. For very memory-heavy algorithms (like Ethereum Wallet), it scales down the thread count. Here's a rough reference for other SCRYPT-based modes: - 64 MiB: 16 threads - 256 MiB: 4 threads Tuning files: All built-in tuningdb entries have been removed, because they shouldn’t be needed anymore. But you can still add custom entries if needed. There’s even a commented-out example in the tuningdb file for mode 22700. Free memory handling: Getting the actual amount of free GPU memory is critical for this to work right. Unfortunately, none of the common GPGPU APIs give reliable numbers. We now query low-level interfaces like SYSFS (AMD) and NVML (NVIDIA). Support for those APIs is in place already, except for ADL, which still needs to be added. Because of this, hwmon support (which handles those low-level queries) can no longer be disabled.
40 lines
1.5 KiB
C
40 lines
1.5 KiB
C
/**
|
|
* Author......: See docs/credits.txt
|
|
* License.....: MIT
|
|
*/
|
|
|
|
#ifndef HC_EXT_SYSFS_AMDGPU_H
|
|
#define HC_EXT_SYSFS_AMDGPU_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
static const char SYS_BUS_PCI_DEVICES[] = "/sys/bus/pci/devices";
|
|
|
|
typedef int HM_ADAPTER_SYSFS_AMDGPU;
|
|
|
|
typedef void *SYSFS_AMDGPU_LIB;
|
|
|
|
typedef struct hm_sysfs_amdgpu_lib
|
|
{
|
|
// currently not using libudev, because it can only read values, not set them, so using /sys instead
|
|
|
|
SYSFS_AMDGPU_LIB lib;
|
|
|
|
} hm_sysfs_amdgpu_lib_t;
|
|
|
|
typedef hm_sysfs_amdgpu_lib_t SYSFS_AMDGPU_PTR;
|
|
|
|
bool sysfs_amdgpu_init (void *hashcat_ctx);
|
|
void sysfs_amdgpu_close (void *hashcat_ctx);
|
|
char *hm_SYSFS_AMDGPU_get_syspath_device (void *hashcat_ctx, const int backend_device_idx);
|
|
char *hm_SYSFS_AMDGPU_get_syspath_hwmon (void *hashcat_ctx, const int backend_device_idx);
|
|
int hm_SYSFS_AMDGPU_get_fan_speed_current (void *hashcat_ctx, const int backend_device_idx, int *val);
|
|
int hm_SYSFS_AMDGPU_get_temperature_current (void *hashcat_ctx, const int backend_device_idx, int *val);
|
|
int hm_SYSFS_AMDGPU_get_pp_dpm_sclk (void *hashcat_ctx, const int backend_device_idx, int *val);
|
|
int hm_SYSFS_AMDGPU_get_pp_dpm_mclk (void *hashcat_ctx, const int backend_device_idx, int *val);
|
|
int hm_SYSFS_AMDGPU_get_pp_dpm_pcie (void *hashcat_ctx, const int backend_device_idx, int *val);
|
|
int hm_SYSFS_AMDGPU_get_gpu_busy_percent (void *hashcat_ctx, const int backend_device_idx, int *val);
|
|
int hm_SYSFS_AMDGPU_get_mem_info_vram_used (void *hashcat_ctx, const int backend_device_idx, u64 *val);
|
|
|
|
#endif // HC_EXT_SYSFS_AMDGPU_H
|