mirror of
https://github.com/hashcat/hashcat.git
synced 2024-12-22 06:38:11 +00:00
Memory Management: Refactored the code responsible for limiting kernel accel in order to avoid out of -host- memory situations
This commit is contained in:
parent
25f1c12e3c
commit
a4299b74af
@ -38,6 +38,7 @@
|
||||
- ECC secp256k1: Removed the inline assembly code for AMD GPUs because the latest JIT compilers optimize it with the same efficiency
|
||||
- HIP Kernels: Got rid of hip/hip_runtime.h dependancy to enable more easy integration of the HIP backend on Windows
|
||||
- Kernel Cache: Add kernel threads into hash computation which is later used in the kernel cache filename
|
||||
- Memory Management: Refactored the code responsible for limiting kernel accel in order to avoid out of -host- memory situations
|
||||
- SCRYPT Kernels: Add more optimized values for some new NV/AMD GPUs
|
||||
|
||||
##
|
||||
|
@ -14882,14 +14882,34 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
u32 kernel_accel_min = device_param->kernel_accel_min;
|
||||
u32 kernel_accel_max = device_param->kernel_accel_max;
|
||||
|
||||
/**
|
||||
* We need a kernel accel limiter otherwise we will allocate too much memory (Example 4* GTX1080):
|
||||
* 4 (gpus) * 260 (sizeof pw_t) * 3 (pws, pws_comp, pw_pre) * 20 (MCU) * 1024 (threads) * 1024 (accel) = 65,431,142,400 bytes RAM!!
|
||||
*/
|
||||
// We need to deal with the situation that the total video RAM > total host RAM.
|
||||
// Especially in multi-GPU setups that is very likely.
|
||||
// The buffers which actually take a lot of memory (except for SCRYPT) are the ones for the password candidates.
|
||||
// They are stored in an aligned order for better performance, but this increases the memory pressure.
|
||||
// The best way to keep these buffers to a reasonable size is by controlling the kernel_accel parameter.
|
||||
//
|
||||
// In theory this check could be disabled if we check if total video RAM < total host RAM,
|
||||
// but at this point of initialization phase we don't have this information available.
|
||||
|
||||
const int max_gb = (hashconfig->opts_type & OPTS_TYPE_MP_MULTI_DISABLE) ? 1024 : 64;
|
||||
// We need to hard-code some value, let's assume that (in 2021) the host has at least 8GB ram per active GPU
|
||||
|
||||
const u32 accel_limit = CEILDIV ((max_gb * 1024), kernel_threads); // this should result in less than 4GB per GPU, but allow higher accel in case user reduces the threads manually using -T
|
||||
const u64 SIZE_8GB = 8UL * 1024 * 1024 * 1024;
|
||||
|
||||
u64 accel_limit = SIZE_8GB;
|
||||
|
||||
// this is device_processors * kernel_threads
|
||||
|
||||
accel_limit /= device_param->hardware_power;
|
||||
|
||||
// single password candidate size
|
||||
|
||||
accel_limit /= sizeof (pw_t);
|
||||
|
||||
// pws[], pws_comp[] and pw_pre[] are some large blocks with password candidates
|
||||
|
||||
accel_limit /= 3;
|
||||
|
||||
// I think vector size is not required because vector_size is dividing the pws_cnt in run_kernel()
|
||||
|
||||
kernel_accel_max = MIN (kernel_accel_max, accel_limit);
|
||||
|
||||
@ -14916,12 +14936,6 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
u64 size_brain_link_out = 4;
|
||||
#endif
|
||||
|
||||
// instead of a thread limit we can also use a memory limit.
|
||||
// this value should represent a reasonable amount of memory a host system has per GPU.
|
||||
// note we're allocating 3 blocks of that size.
|
||||
|
||||
const u64 PWS_SPACE = 1024ULL * 1024ULL * 1024ULL;
|
||||
|
||||
while (kernel_accel_max >= kernel_accel_min)
|
||||
{
|
||||
const u64 kernel_power_max = device_param->hardware_power * kernel_accel_max;
|
||||
@ -14971,8 +14985,6 @@ int backend_session_begin (hashcat_ctx_t *hashcat_ctx)
|
||||
|
||||
int memory_limit_hit = 0;
|
||||
|
||||
if (size_pws > PWS_SPACE) memory_limit_hit = 1;
|
||||
|
||||
// sometimes device_available_mem and device_maxmem_alloc reported back from the opencl runtime are a bit inaccurate.
|
||||
// let's add some extra space just to be sure.
|
||||
// now depends on the kernel-accel value (where scrypt and similar benefits), but also hard minimum 64mb and maximum 1024mb limit
|
||||
|
@ -102,7 +102,7 @@ static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE;
|
||||
static const char *HASH_NAME = "PKZIP (Compressed)";
|
||||
static const u64 KERN_TYPE = 17200;
|
||||
static const u32 OPTI_TYPE = 0;
|
||||
static const u64 OPTS_TYPE = 0;
|
||||
static const u64 OPTS_TYPE = OPTS_TYPE_NATIVE_THREADS;
|
||||
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "$pkzip2$1*1*2*0*e3*1c5*eda7a8de*0*28*8*e3*eda7*5096*a9fc1f4e951c8fb3031a6f903e5f4e3211c8fdc4671547bf77f6f682afbfcc7475d83898985621a7af9bccd1349d1976500a68c48f630b7f22d7a0955524d768e34868880461335417ddd149c65a917c0eb0a4bf7224e24a1e04cf4ace5eef52205f4452e66ded937db9545f843a68b1e84a2e933cc05fb36d3db90e6c5faf1bee2249fdd06a7307849902a8bb24ec7e8a0886a4544ca47979a9dfeefe034bdfc5bd593904cfe9a5309dd199d337d3183f307c2cb39622549a5b9b8b485b7949a4803f63f67ca427a0640ad3793a519b2476c52198488e3e2e04cac202d624fb7d13c2*$/pkzip2$";
|
||||
|
@ -102,7 +102,7 @@ static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE;
|
||||
static const char *HASH_NAME = "PKZIP (Compressed Multi-File)";
|
||||
static const u64 KERN_TYPE = 17220;
|
||||
static const u32 OPTI_TYPE = 0;
|
||||
static const u64 OPTS_TYPE = 0;
|
||||
static const u64 OPTS_TYPE = OPTS_TYPE_NATIVE_THREADS;
|
||||
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "$pkzip2$3*1*1*0*8*24*a425*8827*d1730095cd829e245df04ebba6c52c0573d49d3bbeab6cb385b7fa8a28dcccd3098bfdd7*1*0*8*24*2a74*882a*51281ac874a60baedc375ca645888d29780e20d4076edd1e7154a99bde982152a736311f*2*0*e3*1c5*eda7a8de*0*29*8*e3*eda7*5096*1455781b59707f5151139e018bdcfeebfc89bc37e372883a7ec0670a5eafc622feb338f9b021b6601a674094898a91beac70e41e675f77702834ca6156111a1bf7361bc9f3715d77dfcdd626634c68354c6f2e5e0a7b1e1ce84a44e632d0f6e36019feeab92fb7eac9dda8df436e287aafece95d042059a1b27d533c5eab62c1c559af220dc432f2eb1a38a70f29e8f3cb5a207704274d1e305d7402180fd47e026522792f5113c52a116d5bb25b67074ffd6f4926b221555234aabddc69775335d592d5c7d22462b75de1259e8342a9ba71cb06223d13c7f51f13be2ad76352c3b8ed*$/pkzip2$";
|
||||
|
@ -102,7 +102,7 @@ static const u32 HASH_CATEGORY = HASH_CATEGORY_ARCHIVE;
|
||||
static const char *HASH_NAME = "PKZIP (Mixed Multi-File)";
|
||||
static const u64 KERN_TYPE = 17225;
|
||||
static const u32 OPTI_TYPE = 0;
|
||||
static const u64 OPTS_TYPE = 0;
|
||||
static const u64 OPTS_TYPE = OPTS_TYPE_NATIVE_THREADS;
|
||||
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "$pkzip2$3*1*1*0*0*24*3e2c*3ef8*0619e9d17ff3f994065b99b1fa8aef41c056edf9fa4540919c109742dcb32f797fc90ce0*1*0*8*24*431a*3f26*18e2461c0dbad89bd9cc763067a020c89b5e16195b1ac5fa7fb13bd246d000b6833a2988*2*0*23*17*1e3c1a16*2e4*2f*0*23*1e3c*3f2d*54ea4dbc711026561485bbd191bf300ae24fa0997f3779b688cdad323985f8d3bb8b0c*$/pkzip2$";
|
||||
|
@ -24,7 +24,8 @@ static const u64 KERN_TYPE = 21800;
|
||||
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE
|
||||
| OPTI_TYPE_USES_BITS_64
|
||||
| OPTI_TYPE_SLOW_HASH_SIMD_LOOP;
|
||||
static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE;
|
||||
static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE
|
||||
| OPTS_TYPE_NATIVE_THREADS;
|
||||
static const u32 SALT_TYPE = SALT_TYPE_EMBEDDED;
|
||||
static const char *ST_PASS = "hashcat";
|
||||
static const char *ST_HASH = "$electrum$5*02170fee7c35f1ef3b229edc90fbd0793b688a0d6f41137a97aab2343d315cce16*94cf72d8f5d774932b414a3344984859e43721268d2eb35fa531de5a2fc7024b463c730a54f4f46229dd9fede5034b19ac415c2916e9c16b02094f845795df0c397ff76d597886b1f9e014ad1a8f64a3f617d9900aa645b3ba86f16ce542251fc22c41d93fa6bc118be96d9582917e19d2a299743331804cfc7ce2c035367b4cbcfb70adfb1e10a0f2795769f2165d8fd13daa8b45eeac495b5b63e91a87f63b42e483f84a881e49adecacf6519cb564694b42dd9fe80fcbc6cdb63cf5ae33f35255266f5c2524dd93d3cc15eba0f2ccdc3c109cc2d7e8f711b8b440f168caf8b005e8bcdfe694148e94a04d2a738f09349a96600bd8e8edae793b26ebae231022f24e96cb158db141ac40400a9e9ef099e673cfe017281537c57f82fb45c62bdb64462235a6eefb594961d5eb2c46537958e4d04250804c6e9f343ab7a0db07af6b8a9d1a6c5cfcd311b8fb8383ac9ed9d98d427d526c2f517fc97473bd87cb59899bd0e8fb8c57fa0f7e0d53daa57c972cf92764af4b1725a5fb8f504b663ec519731929b3caaa793d8ee74293eee27d0e208a60e26290bc546e6fa9ed865076e13febfea249729218c1b5752e912055fbf993fbac5df2cca2b37c5e0f9c30789858ceeb3c482a8db123966775aeed2eee2fc34efb160d164929f51589bff748ca773f38978bff3508d5a7591fb2d2795df983504a788071f469d78c88fd7899cabbc5804f458653d0206b82771a59522e1fa794d7de1536c51a437f5d6df5efd6654678e5794ca429b5752e1103340ed80786f1e9da7f5b39af628b2212e4d88cd36b8a7136d50a6b6e275ab406ba7c57cc70d77d01c4c16e9363901164fa92dc9e9b99219d5376f24862e775968605001e71b000e2c7123b4b43f3ca40db17efd729388782e46e64d43ccb947db4eb1473ff1a3836b74fe312cd1a33b73b8b8d80c087088932277773c329f2f66a01d6b3fc1e651c56959ebbed7b14a21b977f3acdedf1a0d98d519a74b50c39b3052d840106da4145345d86ec0461cddafacc2a4f0dd646457ad05bf04dcbcc80516a5c5ed14d2d639a70e77b686f19cbfb63f546d81ae19cc8ba35cce3f3b5b9602df25b678e14411fecec87b8347f5047513df415c6b1a3d39871a6bcb0f67d9cf8311596deae45fd1d84a04fd58f1fd55c5156b7309af09094c99a53674809cb87a45f95a2d69f9997a38085519cb4e056f9efd56672a2c1fe927d5ea8eec25b8aff6e56f9a2310f1a481daf407b8adf16201da267c59973920fd21bb087b88123ef98709839d6a3ee34efb8ccd5c15ed0e46cff3172682769531164b66c8689c35a26299dd26d09233d1f64f9667474141cf9c6a6de7f2bc52c3bb44cfe679ff4b912c06df406283836b3581773cb76d375304f46239da5996594a8d03b14c02f1b35a432dc44a96331242ae31174*33a7ee59d6d17ed1ee99dc0a71771227e6f3734b17ba36eb589bdced56244135";
|
||||
|
0
tools/cryptoloop2hashcat.py
Normal file → Executable file
0
tools/cryptoloop2hashcat.py
Normal file → Executable file
Loading…
Reference in New Issue
Block a user