Skip to content

Commit

Permalink
it's possible to crack scrypt on GPU even with higher scrypt setting
Browse files Browse the repository at this point in the history
the trick is to intentionally under-utilize the GPU warps
120H/s on my 4*1080: https://pastebin.com/z124G2cN
  • Loading branch information
jsteube committed Jun 4, 2017
1 parent 0c5b53d commit 3d888b6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
4 changes: 2 additions & 2 deletions hashcat.hctune
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,6 @@ DEVICE_TYPE_CPU * 8900 1 1
DEVICE_TYPE_CPU * 9300 1 1 1
DEVICE_TYPE_CPU * 15700 1 1 1

DEVICE_TYPE_GPU * 8900 1 8 1
DEVICE_TYPE_GPU * 9300 1 8 1
DEVICE_TYPE_GPU * 8900 1 16 1
DEVICE_TYPE_GPU * 9300 1 16 1
DEVICE_TYPE_GPU * 15700 1 1 1
20 changes: 17 additions & 3 deletions src/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -23515,9 +23515,23 @@ u32 hashconfig_get_kernel_threads (hashcat_ctx_t *hashcat_ctx, const hc_device_p

u32 kernel_threads = MIN (KERNEL_THREADS_MAX, device_param->device_maxworkgroup_size);

if (hashconfig->hash_mode == 8900) kernel_threads = 64; // Scrypt
if (hashconfig->hash_mode == 9300) kernel_threads = 64; // Scrypt
if (hashconfig->hash_mode == 15700) kernel_threads = 64; // Scrypt
if ((hashconfig->hash_mode == 8900) || (hashconfig->hash_mode == 9300) || (hashconfig->hash_mode == 15700))
{
const hashes_t *hashes = hashcat_ctx->hashes;

const u32 scrypt_r = hashes->salts_buf[0].scrypt_r;
const u32 scrypt_p = hashes->salts_buf[0].scrypt_p;
const u32 scrypt_l = scrypt_r * scrypt_p;

if (scrypt_l)
{
kernel_threads = 256 / scrypt_l;
}
else
{
kernel_threads = 256;
}
}

if (device_param->device_type & CL_DEVICE_TYPE_CPU)
{
Expand Down
22 changes: 8 additions & 14 deletions src/opencl.c
Original file line number Diff line number Diff line change
Expand Up @@ -3685,11 +3685,12 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
hashconfig->tmp_size = scrypt_tmp_size;

u32 tmto_start = 0;
u32 tmto_stop = 10;
u32 tmto_stop = 5;

if (user_options->scrypt_tmto)
{
tmto_start = user_options->scrypt_tmto;
tmto_stop = user_options->scrypt_tmto;
}
else
{
Expand Down Expand Up @@ -3718,17 +3719,6 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
tmto_start = 4;
}
}
else if (hashconfig->hash_mode == 15700)
{
if (device_param->device_vendor_id == VENDOR_ID_AMD)
{
tmto_start = 5;
}
else if (device_param->device_vendor_id == VENDOR_ID_NV)
{
tmto_start = 6;
}
}
}

const u32 kernel_power_max = device_param->hardware_power * device_param->kernel_accel_max;
Expand Down Expand Up @@ -3772,9 +3762,11 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
+ size_tm
+ size_tmps;

bool not_enough_memory = true;

u32 tmto;

for (tmto = tmto_start; tmto < tmto_stop; tmto++)
for (tmto = tmto_start; tmto <= tmto_stop; tmto++)
{
size_scrypt = (128 * scrypt_r) * scrypt_N;

Expand All @@ -3801,10 +3793,12 @@ int opencl_session_begin (hashcat_ctx_t *hashcat_ctx)
scrypt_tmto_final = tmto;
}

not_enough_memory = false;

break;
}

if (tmto == tmto_stop)
if (not_enough_memory == true)
{
event_log_error (hashcat_ctx, "Cannot allocate enough device memory.");

Expand Down

0 comments on commit 3d888b6

Please sign in to comment.