From 01c847ba94d262194bc2fbacbd20428d6911a82b Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Tue, 23 Feb 2016 15:00:56 +0100 Subject: [PATCH] Do not use values that can actually crack a hash in autotune --- OpenCL/m00060_a3.cl | 28 +++++++++++++++++----------- src/oclHashcat.c | 37 ++++++++++++------------------------- 2 files changed, 29 insertions(+), 36 deletions(-) diff --git a/OpenCL/m00060_a3.cl b/OpenCL/m00060_a3.cl index b2dd85e..4f405b8 100644 --- a/OpenCL/m00060_a3.cl +++ b/OpenCL/m00060_a3.cl @@ -217,18 +217,28 @@ static void m00060m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le */ u32 salt_buf0[4]; + u32 salt_buf1[4]; + u32 salt_buf2[4]; + u32 salt_buf3[4]; salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0]; salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1]; salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2]; salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3]; - - u32 salt_buf1[4]; - salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4]; salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5]; salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6]; salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7]; + salt_buf2[0] = salt_bufs[salt_pos].salt_buf[ 8]; + salt_buf2[1] = salt_bufs[salt_pos].salt_buf[ 9]; + salt_buf2[2] = salt_bufs[salt_pos].salt_buf[10]; + salt_buf2[3] = salt_bufs[salt_pos].salt_buf[11]; + salt_buf3[0] = salt_bufs[salt_pos].salt_buf[12]; + salt_buf3[1] = salt_bufs[salt_pos].salt_buf[13]; + salt_buf3[2] = salt_bufs[salt_pos].salt_buf[14]; + salt_buf3[3] = salt_bufs[salt_pos].salt_buf[15]; + + const u32 salt_len = salt_bufs[salt_pos].salt_len; /** * pads @@ -271,9 +281,9 @@ static void m00060m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le { const u32x w0r = ix_create_bft (bfs_buf, il_pos); - const u32x w0rl = w0r | w0l; + const u32x w0lr = w0l | w0r; - w0_t[0] = w0rl; + w0_t[0] = w0lr; w0_t[1] = w0[1]; w0_t[2] = w0[2]; w0_t[3] = w0[3]; @@ -290,8 +300,6 @@ static void m00060m (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le w3_t[2] = (64 + pw_len) * 8; w3_t[3] = 0; - append_0x80_4x4 (w0_t, w1_t, w2_t, w3_t, pw_len); - u32x digest[4]; hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest); @@ -390,9 +398,9 @@ static void m00060s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le { const u32x w0r = ix_create_bft (bfs_buf, il_pos); - const u32x w0rl = w0r | w0l; + const u32x w0lr = w0l | w0r; - w0_t[0] = w0rl; + w0_t[0] = w0lr; w0_t[1] = w0[1]; w0_t[2] = w0[2]; w0_t[3] = w0[3]; @@ -409,8 +417,6 @@ static void m00060s (u32 w0[4], u32 w1[4], u32 w2[4], u32 w3[4], const u32 pw_le w3_t[2] = (64 + pw_len) * 8; w3_t[3] = 0; - append_0x80_4x4 (w0_t, w1_t, w2_t, w3_t, pw_len); - u32x digest[4]; hmac_md5_run (w0_t, w1_t, w2_t, w3_t, ipad, opad, digest); diff --git a/src/oclHashcat.c b/src/oclHashcat.c index 9ab8a6c..71eb5c3 100644 --- a/src/oclHashcat.c +++ b/src/oclHashcat.c @@ -2823,24 +2823,17 @@ static double try_run (hc_device_param_t *device_param, const u32 kernel_accel, // init some fake words - if (data.attack_kern == ATTACK_KERN_BF) + for (u32 i = 0; i < kernel_power; i++) { - run_kernel_mp (KERN_RUN_MP_L, device_param, kernel_power); - run_kernel_mp (KERN_RUN_MP_R, device_param, kernel_loops); + device_param->pws_buf[i].i[1] = 0x01234567; + device_param->pws_buf[i].pw_len = i & 7; } - else - { - for (u32 i = 0; i < kernel_power; i++) - { - device_param->pws_buf[i].pw_len = i & 7; - } - hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL); + hc_clEnqueueWriteBuffer (data.ocl, device_param->command_queue, device_param->d_pws_buf, CL_TRUE, 0, kernel_power * sizeof (pw_t), device_param->pws_buf, 0, NULL, NULL); - if (data.attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL) - { - run_kernel_amp (device_param, kernel_power); - } + if (data.attack_exec == ATTACK_EXEC_OUTSIDE_KERNEL) + { + run_kernel_amp (device_param, kernel_power); } // caching run @@ -2991,12 +2984,10 @@ static void autotune (hc_device_param_t *device_param) // final balance - const double exec_ms = try_run (device_param, kernel_accel, kernel_loops, 1); - u32 kernel_accel_best = kernel_accel; u32 kernel_loops_best = kernel_loops; - u32 exec_best = exec_ms; + u32 exec_best = -1; // reset @@ -3023,14 +3014,10 @@ static void autotune (hc_device_param_t *device_param) exec_best = exec_ms; } } - - kernel_accel = kernel_accel_best; - kernel_loops = kernel_loops_best; } // reset - if (kernel_loops_min < kernel_loops_max) { u32 kernel_accel_try = kernel_accel; @@ -3054,9 +3041,6 @@ static void autotune (hc_device_param_t *device_param) exec_best = exec_ms; } } - - kernel_accel = kernel_accel_best; - kernel_loops = kernel_loops_best; } // reset timer @@ -3067,8 +3051,11 @@ static void autotune (hc_device_param_t *device_param) // store - device_param->kernel_loops = kernel_loops; + kernel_accel = kernel_accel_best; + kernel_loops = kernel_loops_best; + device_param->kernel_accel = kernel_accel; + device_param->kernel_loops = kernel_loops; const u32 kernel_power = device_param->device_processors * device_param->kernel_threads * device_param->kernel_accel; -- 2.25.1