1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-07-10 00:28:11 +00:00
Commit Graph

391 Commits

Author SHA1 Message Date
Jens Steube
7fe091f4a3 Always use the low-level API to query used memory on a device and silently ignore if unavailable.
The workaround using EXTRA_SIZE should no longer be needed, so we disable it for now and monitor for any issues with memory allocation.
Fixed a bug where a scrypt-based algorithm on an API would require only a single work item, resulting in size_extra_buffer4 being zero, which fails on OpenCL since it does not allow zero-byte allocations.
Ignore TMTO increase on low scrypt configurations if the R value is higher than 1.
2025-06-17 19:09:53 +02:00
Jens Steube
4b93a6e93c Add support for detecting unified GPU memory on CUDA and HIP (previously available only for OpenCL and Metal).
Do not adjust kernel-accel or scrypt-tmto for GPUs with unified memory, typically integrated GPUs in CPUs (APUs).
Redesign the "4-buffer" strategy to avoid overallocation from naive division by four, which can significantly increase memory usage for high scrypt configurations (e.g., 256k:8:1).
Update the scrypt B[] access pattern to match the new "4-buffer" design.
Allow user-specified kernel-accel and scrypt-tmto values, individually or both, via command line and tuning database. Any unspecified parameters are adjusted automatically.
Permit user-defined combinations of scrypt-tmto and kernel-accel even if they may exceed available memory.
2025-06-17 13:32:57 +02:00
Jens Steube
07395626fa Introduce hashes_init_stage5() and call module_extra_tmp_size() there. At this stage, the self-test hash is initialized and its values can be used.
Remove hard-coded SCRYPT N, R, and P values in modules, except where they are intentionally hardcoded.
Fix a bug that always caused a TMTO value of 1, even when it was not needed.
Respect device_available_mem and device_maxmem_alloc values even if a reliable low-level free memory API is present, and always select the lowest of all available limits.
Fix benchmark_deep.pl mask to avoid UTF-8 rejects.
Improve error messages when the check verifying that all SCRYPT configuration settings across all hashes are identical is triggered.
Also improve the error message shown when the SCRYPT configuration of the self-test hash does not match that of the target hash.
Fix a bug where a low-tuned SCRYPT hash combined with a TMTO could result in fewer than 1024 iterations, which breaks the hard-coded minimum of 1024 iterations in the SCRYPT kernel.
2025-06-15 14:13:48 +02:00
Jens Steube
ac6891e754
Merge pull request #4115 from wizardsd/master
Fixed a host buffer overflow bug when copying rules from host to device
2025-06-12 09:20:58 +02:00
Jens Steube
4e0a728f8f Add HC_ATTR_SEQ as a workaround, since HIP no longer
supports compiler option --gpu-max-threads-per-block
2025-06-12 09:17:02 +02:00
Jens Steube
30ac079caf Use total memory as base if low-level free memory API is available.
Prefix device name in tuning-db with device ID to avoid collisions
between identically named devices.

Fix Python bridge Makefile to handle missing python3-config helper.
2025-06-11 11:15:44 +02:00
Jens Steube
4246345950
Merge pull request #4249 from matrix/metal_device_alias
Alias Devices: Prevents hashcat, when started with x86_64 emulation on Apple Silicon, from showing the Apple M1 OpenCL CPU as an alias for the Apple M1 Metal GPU
2025-06-11 11:02:08 +02:00
Gabriele Gristina
1096d961a1
Backend: Updated filename chksum format to prevent invalid cache on Apple Silicon when switching arch 2025-06-10 23:19:12 +02:00
Gabriele Gristina
ef8223b17a
Alias Devices: Prevents hashcat, when started with x86_64 emulation on Apple Silicon, from showing the Apple M1 OpenCL CPU as an alias for the Apple M1 Metal GPU 2025-06-10 21:49:21 +02:00
Jens Steube
6aeb188b48 - Handle case where system does not offer any reliable method to query actual free memory
- Change package script source folder from $HOME/hashcat to .
- Revisited Apple OpenCL 2GiB Bug (still present)
2025-06-10 12:54:15 +02:00
Jens Steube
c87a87f992 Improvements to SCRYPT autotuning strategy
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.
2025-06-09 11:02:34 +02:00
Jens Steube
ed6e967425 Add experimental SCRYPT N-parameter auto-discovery
Remove existing tuningdb entries due to salsa_r() core
refactor. Update tuningdb engine to prefer file entries,
when available, over automatic discovery.

Improve memory-free detection per device, default
--backend-device-keepfree is now set to 0.

Old brute-force OpenCL behavior can be restored using
--backend-device-keepfree 100.
2025-06-08 07:32:32 +02:00
Gabriele Gristina
12f1fe56aa OpenCL Backend: added workaround to set device_available_memory from CUDA/HIP alias device 2025-06-07 20:22:01 +02:00
Gabriele Gristina
378abf6957 Metal Backend: added workaround to set the true Processor value in Metal devices on Apple Intel 2025-06-07 17:52:34 +02:00
Jens Steube
d60658102b Added option --backend-devices-keepfree to configure X percentage of device memory available to keep free 2025-06-04 10:13:29 +02:00
Jens Steube
bf110ee10f
Merge branch 'master' into asahi-fix 2025-06-03 14:59:04 +02:00
Jens Steube
b02b1b5033 - Add code to recognize Microsofts OpenCL D3D12 platform
- Skip memory-free detection on MS OpenCL platform to avoid crashes
- Improve salt usage of 70100/70200, use decoder/kernels from 8900
- Add REPLACE bridge type support (eg. BRIDGE_TYPE_REPLACE_LOOP)
- Switch 70000, 70100 and 70200 to BRIDGE_TYPE_REPLACE_LOOP
- Add synchronization barriers on d2h copy when using bridges
- Improve speed status display updates when using bridges
- Set AMD_DIRECT_DISPATCH=0 to reduce CPU burning loop on AMD backends
- Set benchmark/selftest hash on 70100/70200 to 16:8:1
2025-06-02 06:59:36 +02:00
Jens Steube
22c25b3ea1 Fix cross-compiler target in makefiles
Do not show timeout patch warnings in virtualized mode
2025-06-01 06:39:55 +02:00
Jens Steube
ceb5ff5641 The Assimilation Bridge (Framework) 2025-05-29 15:38:13 +02:00
Jens Steube
f9822fe569
Merge pull request #4185 from matrix/deep_comp_aux_workaround
workaround for issue #3914
2025-05-25 08:14:23 +02:00
Jens Steube
b0c7765e88 - Backport code from hipDllPath to hiprtcDllPath
- Fix some compiler warning
- Remove some unused code
- We will add changes to docs/ and user-notifications on versioning later
2025-05-11 14:08:04 +02:00
Jens Steube
d10ffbb461 Change amdhip64.dll installation path detection strategy 2025-05-10 12:11:40 +00:00
Gabriele Gristina
6568c5988b fix #3914 2025-04-18 14:17:21 +02:00
Code Curiously
5b26392adb Fix RAM usage bug for Linux Apple Silicon #4125 2024-12-01 19:20:26 +00:00
wizardsd
0ba76629c0 Fixed a host buffer overflow bug when copying rules from host to device 2024-11-07 12:47:36 +03:00
Mathias
d756a6617c
Update backend.c
Fixes hiprtcCompileProgram(): HIPRTC_ERROR_COMPILATION on AMD 6900XT.

```bash
hiprtcCompileProgram(): HIPRTC_ERROR_COMPILATION

ld.lld: error: undefined hidden symbol: __ockl_get_group_id
>>> referenced by /home/mathias/.local/share/hashcat/comgr-69ec34/input/shared_kernel.o:(gpu_decompress)
>>> referenced by /home/mathias/.local/share/hashcat/comgr-69ec34/input/shared_kernel.o:(gpu_decompress)
>>> referenced by /home/mathias/.local/share/hashcat/comgr-69ec34/input/shared_kernel.o:(gpu_memset)
>>> referenced 7 more times

ld.lld: error: undefined hidden symbol: __ockl_get_local_size
>>> referenced by /home/mathias/.local/share/hashcat/comgr-69ec34/input/shared_kernel.o:(gpu_decompress)
>>> referenced by /home/mathias/.local/share/hashcat/comgr-69ec34/input/shared_kernel.o:(gpu_decompress)
>>> referenced by /home/mathias/.local/share/hashcat/comgr-69ec34/input/shared_kernel.o:(gpu_memset)
>>> referenced 7 more times

ld.lld: error: undefined hidden symbol: __ockl_get_local_id
>>> referenced by /home/mathias/.local/share/hashcat/comgr-69ec34/input/shared_kernel.o:(gpu_decompress)
>>> referenced by /home/mathias/.local/share/hashcat/comgr-69ec34/input/shared_kernel.o:(gpu_decompress)
>>> referenced by /home/mathias/.local/share/hashcat/comgr-69ec34/input/shared_kernel.o:(gpu_memset)
>>> referenced 7 more times

* Device #1: Kernel /usr/local/share/hashcat/OpenCL/shared.cl build failed.

* Device #1: Kernel /usr/local/share/hashcat/OpenCL/shared.cl build failed.
```
2024-10-29 15:35:10 +01:00
fse-a
f8c0899670 Increased-virtual-backend-limit
Increased the virtual backend limit.
2024-01-25 10:27:38 +01:00
Sergey Popov
c7923fe8ba Fix RAM usage for Intel iGPUs 2023-11-24 23:03:00 +02:00
jsteube
c59b4bffd5 Add note on how to get CUDA running on WSL2 2023-09-27 08:14:51 +00:00
jsteube
0d0a07012c Do not show HIPRTC notice if HIP is not installed. In that case we can assume the system doesn't have an AMD GPU 2023-09-26 08:52:46 +00:00
Rosen Penev
ae07d65f34 clang-tidy: remove useless casts
Now that const was fixed, pointless casts can be removed.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-20 21:10:34 -07:00
Rosen Penev
795674c939 fix some const-qual warnings
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-20 20:55:54 -07:00
Rosen Penev
a59e030d7f
fix MinGW compilation
HC_API_CALL needs to be placed not just on the declaration.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2023-08-11 23:16:27 -07:00
jsteube
96b05b2630 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) 2023-08-05 15:58:22 +00:00
justpretending
b2f14f2f5d Fix some typos 2023-07-27 23:11:55 +07:00
jsteube
ab932815ea Fixed out-of-boundary read in autotune.c when a fast hash defines a kernel_loops_min value that is higher than the actual number of amplifiers provided by the user 2023-07-04 09:40:39 +00:00
Gabriele Gristina
ef81520158 Metal Backend: disable Metal devices only if at least one OpenCL device is active 2023-06-14 21:11:42 +02:00
Jens Steube
32517211a5
Merge pull request #3760 from matrix/check_invalid_kern_type
do not allow negative kern_type
2023-06-14 03:25:35 +02:00
Gabriele Gristina
eb276f12f6 do not allow negative kern_type 2023-06-07 21:06:57 +02:00
Gabriele Gristina
737989b7cf Metal Backend: allow use of devices with Metal if runtime version is >= 200 2023-06-07 01:17:30 +02:00
Gabriele Gristina
36606addac Help: show supported hash-modes only with -hh 2023-05-01 17:38:42 +02:00
jsteube
6785a32e7a Added new feature (-Y) that creates N virtual instances for each device in your system at the cost of N times the device memory consumption 2023-04-16 12:04:34 +00:00
Jens Steube
b1ca2ca539 Only try to allocate memory on a opencl device if it actually has memory 2023-04-11 10:17:32 +00:00
jsteube
6ad36db9ba Add some detailed information/warnings about dropped HIPRTC symbols in the current AMD Adrenalin driver 2023-03-29 20:16:36 +00:00
Dávid Bolvanský
29a461cb51
Respect quiet flag when printing Metal API warning
Fixes https://github.com/hashcat/hashcat/issues/3624
2023-03-28 00:05:46 +02:00
Royce Williams
ebe8741000 link to driver FAQ on CUDA failure 2023-03-07 12:27:30 -09:00
beschio
69a945ea75
fix Metal API advice 2023-02-04 22:47:10 +01:00
jsteube
3390159bb2 AMD Driver: Updated requirements for AMD Windows drivers to "AMD Adrenalin Edition" (Adrenalin 22.5.1 exactly) 2023-01-04 08:36:37 +00:00
jsteube
c6a7826d12 Do not show metal disabled warning in backend information mode 2023-01-03 13:59:59 +00:00
jsteube
9651d3025c Fix error in backend.c if compiling on macOS 2022-12-31 16:04:35 +00:00