1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-17 19:21:11 +00:00

Converted to new SIMD: -m 7600 -a 0

This commit is contained in:
Jens Steube 2016-02-06 10:49:44 +01:00
parent 81f3fd3c7f
commit e8c0410bcd

View File

@ -5,6 +5,8 @@
#define _SHA1_ #define _SHA1_
#define NEW_SIMD_CODE
#include "include/constants.h" #include "include/constants.h"
#include "include/kernel_vendor.h" #include "include/kernel_vendor.h"
@ -18,9 +20,7 @@
#include "OpenCL/common.c" #include "OpenCL/common.c"
#include "include/rp_kernel.h" #include "include/rp_kernel.h"
#include "OpenCL/rp.c" #include "OpenCL/rp.c"
#include "OpenCL/simd.c"
#define COMPARE_S "OpenCL/check_single_comp4.c"
#define COMPARE_M "OpenCL/check_multi_comp4.c"
#if VECT_SIZE == 1 #if VECT_SIZE == 1
#define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i)]) #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i)])
@ -121,37 +121,14 @@ __kernel void m07600_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* loop * loop
*/ */
for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++) for (u32 il_pos = 0; il_pos < rules_cnt; il_pos += VECT_SIZE)
{ {
u32 w0[4]; u32x w0[4] = { 0 };
u32x w1[4] = { 0 };
u32x w2[4] = { 0 };
u32x w3[4] = { 0 };
w0[0] = pw_buf0[0]; const u32 out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
w0[1] = pw_buf0[1];
w0[2] = pw_buf0[2];
w0[3] = pw_buf0[3];
u32 w1[4];
w1[0] = pw_buf1[0];
w1[1] = pw_buf1[1];
w1[2] = pw_buf1[2];
w1[3] = pw_buf1[3];
u32 w2[4];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
u32 w3[4];
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
append_0x80_2x4 (w0, w1, out_len); append_0x80_2x4 (w0, w1, out_len);
@ -159,28 +136,28 @@ __kernel void m07600_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* sha1 * sha1
*/ */
u32 w0_t = swap32 (w0[0]); u32x w0_t = swap32 (w0[0]);
u32 w1_t = swap32 (w0[1]); u32x w1_t = swap32 (w0[1]);
u32 w2_t = swap32 (w0[2]); u32x w2_t = swap32 (w0[2]);
u32 w3_t = swap32 (w0[3]); u32x w3_t = swap32 (w0[3]);
u32 w4_t = swap32 (w1[0]); u32x w4_t = swap32 (w1[0]);
u32 w5_t = swap32 (w1[1]); u32x w5_t = swap32 (w1[1]);
u32 w6_t = swap32 (w1[2]); u32x w6_t = swap32 (w1[2]);
u32 w7_t = swap32 (w1[3]); u32x w7_t = swap32 (w1[3]);
u32 w8_t = swap32 (w2[0]); u32x w8_t = swap32 (w2[0]);
u32 w9_t = swap32 (w2[1]); u32x w9_t = swap32 (w2[1]);
u32 wa_t = swap32 (w2[2]); u32x wa_t = swap32 (w2[2]);
u32 wb_t = swap32 (w2[3]); u32x wb_t = swap32 (w2[3]);
u32 wc_t = swap32 (w3[0]); u32x wc_t = swap32 (w3[0]);
u32 wd_t = swap32 (w3[1]); u32x wd_t = swap32 (w3[1]);
u32 we_t = 0; u32x we_t = 0;
u32 wf_t = out_len * 8; u32x wf_t = out_len * 8;
u32 a = SHA1M_A; u32x a = SHA1M_A;
u32 b = SHA1M_B; u32x b = SHA1M_B;
u32 c = SHA1M_C; u32x c = SHA1M_C;
u32 d = SHA1M_D; u32x d = SHA1M_D;
u32 e = SHA1M_E; u32x e = SHA1M_E;
#undef K #undef K
#define K SHA1C00 #define K SHA1C00
@ -288,7 +265,7 @@ __kernel void m07600_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* Prepend salt * Prepend salt
*/ */
u32 w0t[4]; u32x w0t[4];
w0t[0] = uint_to_hex_lower8 ((a >> 24) & 255) << 0 w0t[0] = uint_to_hex_lower8 ((a >> 24) & 255) << 0
| uint_to_hex_lower8 ((a >> 16) & 255) << 16; | uint_to_hex_lower8 ((a >> 16) & 255) << 16;
@ -299,7 +276,7 @@ __kernel void m07600_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
w0t[3] = uint_to_hex_lower8 ((b >> 8) & 255) << 0 w0t[3] = uint_to_hex_lower8 ((b >> 8) & 255) << 0
| uint_to_hex_lower8 ((b >> 0) & 255) << 16; | uint_to_hex_lower8 ((b >> 0) & 255) << 16;
u32 w1t[4]; u32x w1t[4];
w1t[0] = uint_to_hex_lower8 ((c >> 24) & 255) << 0 w1t[0] = uint_to_hex_lower8 ((c >> 24) & 255) << 0
| uint_to_hex_lower8 ((c >> 16) & 255) << 16; | uint_to_hex_lower8 ((c >> 16) & 255) << 16;
@ -310,7 +287,7 @@ __kernel void m07600_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
w1t[3] = uint_to_hex_lower8 ((d >> 8) & 255) << 0 w1t[3] = uint_to_hex_lower8 ((d >> 8) & 255) << 0
| uint_to_hex_lower8 ((d >> 0) & 255) << 16; | uint_to_hex_lower8 ((d >> 0) & 255) << 16;
u32 w2t[2]; u32x w2t[2];
w2t[0] = uint_to_hex_lower8 ((e >> 24) & 255) << 0 w2t[0] = uint_to_hex_lower8 ((e >> 24) & 255) << 0
| uint_to_hex_lower8 ((e >> 16) & 255) << 16; | uint_to_hex_lower8 ((e >> 16) & 255) << 16;
@ -465,11 +442,11 @@ __kernel void m07600_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
d += SHA1M_D; d += SHA1M_D;
e += SHA1M_E; e += SHA1M_E;
u32 r_a = a; u32x r_a = a;
u32 r_b = b; u32x r_b = b;
u32 r_c = c; u32x r_c = c;
u32 r_d = d; u32x r_d = d;
u32 r_e = e; u32x r_e = e;
// 2nd transform // 2nd transform
@ -592,12 +569,7 @@ __kernel void m07600_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
d += r_d; d += r_d;
e += r_e; e += r_e;
const u32 r0 = d; COMPARE_M_SIMD (d, e, c, b);
const u32 r1 = e;
const u32 r2 = c;
const u32 r3 = b;
#include COMPARE_M
} }
} }
@ -710,43 +682,20 @@ __kernel void m07600_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* reverse * reverse
*/ */
const u32 e_rev = rotl32 (search[1], 2u); const u32 e_rev = rotl32_S (search[1], 2u);
/** /**
* loop * loop
*/ */
for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++) for (u32 il_pos = 0; il_pos < rules_cnt; il_pos += VECT_SIZE)
{ {
u32 w0[4]; u32x w0[4] = { 0 };
u32x w1[4] = { 0 };
u32x w2[4] = { 0 };
u32x w3[4] = { 0 };
w0[0] = pw_buf0[0]; const u32 out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
w0[1] = pw_buf0[1];
w0[2] = pw_buf0[2];
w0[3] = pw_buf0[3];
u32 w1[4];
w1[0] = pw_buf1[0];
w1[1] = pw_buf1[1];
w1[2] = pw_buf1[2];
w1[3] = pw_buf1[3];
u32 w2[4];
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
u32 w3[4];
w3[0] = 0;
w3[1] = 0;
w3[2] = 0;
w3[3] = 0;
const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
append_0x80_2x4 (w0, w1, out_len); append_0x80_2x4 (w0, w1, out_len);
@ -754,28 +703,28 @@ __kernel void m07600_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* sha1 * sha1
*/ */
u32 w0_t = swap32 (w0[0]); u32x w0_t = swap32 (w0[0]);
u32 w1_t = swap32 (w0[1]); u32x w1_t = swap32 (w0[1]);
u32 w2_t = swap32 (w0[2]); u32x w2_t = swap32 (w0[2]);
u32 w3_t = swap32 (w0[3]); u32x w3_t = swap32 (w0[3]);
u32 w4_t = swap32 (w1[0]); u32x w4_t = swap32 (w1[0]);
u32 w5_t = swap32 (w1[1]); u32x w5_t = swap32 (w1[1]);
u32 w6_t = swap32 (w1[2]); u32x w6_t = swap32 (w1[2]);
u32 w7_t = swap32 (w1[3]); u32x w7_t = swap32 (w1[3]);
u32 w8_t = swap32 (w2[0]); u32x w8_t = swap32 (w2[0]);
u32 w9_t = swap32 (w2[1]); u32x w9_t = swap32 (w2[1]);
u32 wa_t = swap32 (w2[2]); u32x wa_t = swap32 (w2[2]);
u32 wb_t = swap32 (w2[3]); u32x wb_t = swap32 (w2[3]);
u32 wc_t = swap32 (w3[0]); u32x wc_t = swap32 (w3[0]);
u32 wd_t = swap32 (w3[1]); u32x wd_t = swap32 (w3[1]);
u32 we_t = 0; u32x we_t = 0;
u32 wf_t = out_len * 8; u32x wf_t = out_len * 8;
u32 a = SHA1M_A; u32x a = SHA1M_A;
u32 b = SHA1M_B; u32x b = SHA1M_B;
u32 c = SHA1M_C; u32x c = SHA1M_C;
u32 d = SHA1M_D; u32x d = SHA1M_D;
u32 e = SHA1M_E; u32x e = SHA1M_E;
#undef K #undef K
#define K SHA1C00 #define K SHA1C00
@ -883,7 +832,7 @@ __kernel void m07600_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
* Prepend salt * Prepend salt
*/ */
u32 w0t[4]; u32x w0t[4];
w0t[0] = uint_to_hex_lower8 ((a >> 24) & 255) << 0 w0t[0] = uint_to_hex_lower8 ((a >> 24) & 255) << 0
| uint_to_hex_lower8 ((a >> 16) & 255) << 16; | uint_to_hex_lower8 ((a >> 16) & 255) << 16;
@ -894,7 +843,7 @@ __kernel void m07600_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
w0t[3] = uint_to_hex_lower8 ((b >> 8) & 255) << 0 w0t[3] = uint_to_hex_lower8 ((b >> 8) & 255) << 0
| uint_to_hex_lower8 ((b >> 0) & 255) << 16; | uint_to_hex_lower8 ((b >> 0) & 255) << 16;
u32 w1t[4]; u32x w1t[4];
w1t[0] = uint_to_hex_lower8 ((c >> 24) & 255) << 0 w1t[0] = uint_to_hex_lower8 ((c >> 24) & 255) << 0
| uint_to_hex_lower8 ((c >> 16) & 255) << 16; | uint_to_hex_lower8 ((c >> 16) & 255) << 16;
@ -905,7 +854,7 @@ __kernel void m07600_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
w1t[3] = uint_to_hex_lower8 ((d >> 8) & 255) << 0 w1t[3] = uint_to_hex_lower8 ((d >> 8) & 255) << 0
| uint_to_hex_lower8 ((d >> 0) & 255) << 16; | uint_to_hex_lower8 ((d >> 0) & 255) << 16;
u32 w2t[2]; u32x w2t[2];
w2t[0] = uint_to_hex_lower8 ((e >> 24) & 255) << 0 w2t[0] = uint_to_hex_lower8 ((e >> 24) & 255) << 0
| uint_to_hex_lower8 ((e >> 16) & 255) << 16; | uint_to_hex_lower8 ((e >> 16) & 255) << 16;
@ -1060,11 +1009,11 @@ __kernel void m07600_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
d += SHA1M_D; d += SHA1M_D;
e += SHA1M_E; e += SHA1M_E;
u32 r_a = a; u32x r_a = a;
u32 r_b = b; u32x r_b = b;
u32 r_c = c; u32x r_c = c;
u32 r_d = d; u32x r_d = d;
u32 r_e = e; u32x r_e = e;
// 2nd transform // 2nd transform
@ -1187,12 +1136,7 @@ __kernel void m07600_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf,
d += r_d; d += r_d;
e += r_e; e += r_e;
const u32 r0 = d; COMPARE_S_SIMD (d, e, c, b);
const u32 r1 = e;
const u32 r2 = c;
const u32 r3 = b;
#include COMPARE_S
} }
} }