2 * Author......: Jens Steube <jens.steube@gmail.com>
10 #include "include/constants.h"
11 #include "include/kernel_vendor.h"
18 #include "include/kernel_functions.c"
19 #include "OpenCL/types_ocl.c"
20 #include "OpenCL/common.c"
21 #include "include/rp_kernel.h"
22 #include "OpenCL/rp.c"
23 #include "OpenCL/simd.c"
25 __kernel void m01000_m04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
31 const u32 lid = get_local_id (0);
37 const u32 gid = get_global_id (0);
39 if (gid >= gid_max) return;
43 pw_buf0[0] = pws[gid].i[ 0];
44 pw_buf0[1] = pws[gid].i[ 1];
45 pw_buf0[2] = pws[gid].i[ 2];
46 pw_buf0[3] = pws[gid].i[ 3];
50 pw_buf1[0] = pws[gid].i[ 4];
51 pw_buf1[1] = pws[gid].i[ 5];
52 pw_buf1[2] = pws[gid].i[ 6];
53 pw_buf1[3] = pws[gid].i[ 7];
55 const u32 pw_len = pws[gid].pw_len;
61 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos += VECT_SIZE)
68 const u32 out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
70 append_0x80_2x4 (w0, w1, out_len);
77 make_unicode (w0, w0_t, w1_t);
78 make_unicode (w1, w2_t, w3_t);
80 w3_t[2] = out_len * 8 * 2;
87 MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
88 MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
89 MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
90 MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
91 MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
92 MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
93 MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
94 MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
95 MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
96 MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
97 MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
98 MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
99 MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
100 MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
101 MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
102 MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
104 MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
105 MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
106 MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
107 MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
108 MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
109 MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
110 MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
111 MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
112 MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
113 MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
114 MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
115 MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
116 MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
117 MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
118 MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
119 MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
121 MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
122 MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
123 MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
124 MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
125 MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
126 MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
127 MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
128 MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
129 MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
130 MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
131 MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
132 MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
133 MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
134 MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
135 MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
136 MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
138 COMPARE_M_SIMD (a, d, c, b);
142 __kernel void m01000_m08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
146 __kernel void m01000_m16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
150 __kernel void m01000_s04 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
156 const u32 lid = get_local_id (0);
162 const u32 gid = get_global_id (0);
164 if (gid >= gid_max) return;
168 pw_buf0[0] = pws[gid].i[ 0];
169 pw_buf0[1] = pws[gid].i[ 1];
170 pw_buf0[2] = pws[gid].i[ 2];
171 pw_buf0[3] = pws[gid].i[ 3];
175 pw_buf1[0] = pws[gid].i[ 4];
176 pw_buf1[1] = pws[gid].i[ 5];
177 pw_buf1[2] = pws[gid].i[ 6];
178 pw_buf1[3] = pws[gid].i[ 7];
180 const u32 pw_len = pws[gid].pw_len;
186 const u32 search[4] =
188 digests_buf[digests_offset].digest_buf[DGST_R0],
189 digests_buf[digests_offset].digest_buf[DGST_R1],
190 digests_buf[digests_offset].digest_buf[DGST_R2],
191 digests_buf[digests_offset].digest_buf[DGST_R3]
198 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos += VECT_SIZE)
205 const u32 out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
207 append_0x80_2x4 (w0, w1, out_len);
214 make_unicode (w0, w0_t, w1_t);
215 make_unicode (w1, w2_t, w3_t);
217 w3_t[2] = out_len * 8 * 2;
224 MD4_STEP (MD4_Fo, a, b, c, d, w0_t[0], MD4C00, MD4S00);
225 MD4_STEP (MD4_Fo, d, a, b, c, w0_t[1], MD4C00, MD4S01);
226 MD4_STEP (MD4_Fo, c, d, a, b, w0_t[2], MD4C00, MD4S02);
227 MD4_STEP (MD4_Fo, b, c, d, a, w0_t[3], MD4C00, MD4S03);
228 MD4_STEP (MD4_Fo, a, b, c, d, w1_t[0], MD4C00, MD4S00);
229 MD4_STEP (MD4_Fo, d, a, b, c, w1_t[1], MD4C00, MD4S01);
230 MD4_STEP (MD4_Fo, c, d, a, b, w1_t[2], MD4C00, MD4S02);
231 MD4_STEP (MD4_Fo, b, c, d, a, w1_t[3], MD4C00, MD4S03);
232 MD4_STEP (MD4_Fo, a, b, c, d, w2_t[0], MD4C00, MD4S00);
233 MD4_STEP (MD4_Fo, d, a, b, c, w2_t[1], MD4C00, MD4S01);
234 MD4_STEP (MD4_Fo, c, d, a, b, w2_t[2], MD4C00, MD4S02);
235 MD4_STEP (MD4_Fo, b, c, d, a, w2_t[3], MD4C00, MD4S03);
236 MD4_STEP (MD4_Fo, a, b, c, d, w3_t[0], MD4C00, MD4S00);
237 MD4_STEP (MD4_Fo, d, a, b, c, w3_t[1], MD4C00, MD4S01);
238 MD4_STEP (MD4_Fo, c, d, a, b, w3_t[2], MD4C00, MD4S02);
239 MD4_STEP (MD4_Fo, b, c, d, a, w3_t[3], MD4C00, MD4S03);
241 MD4_STEP (MD4_Go, a, b, c, d, w0_t[0], MD4C01, MD4S10);
242 MD4_STEP (MD4_Go, d, a, b, c, w1_t[0], MD4C01, MD4S11);
243 MD4_STEP (MD4_Go, c, d, a, b, w2_t[0], MD4C01, MD4S12);
244 MD4_STEP (MD4_Go, b, c, d, a, w3_t[0], MD4C01, MD4S13);
245 MD4_STEP (MD4_Go, a, b, c, d, w0_t[1], MD4C01, MD4S10);
246 MD4_STEP (MD4_Go, d, a, b, c, w1_t[1], MD4C01, MD4S11);
247 MD4_STEP (MD4_Go, c, d, a, b, w2_t[1], MD4C01, MD4S12);
248 MD4_STEP (MD4_Go, b, c, d, a, w3_t[1], MD4C01, MD4S13);
249 MD4_STEP (MD4_Go, a, b, c, d, w0_t[2], MD4C01, MD4S10);
250 MD4_STEP (MD4_Go, d, a, b, c, w1_t[2], MD4C01, MD4S11);
251 MD4_STEP (MD4_Go, c, d, a, b, w2_t[2], MD4C01, MD4S12);
252 MD4_STEP (MD4_Go, b, c, d, a, w3_t[2], MD4C01, MD4S13);
253 MD4_STEP (MD4_Go, a, b, c, d, w0_t[3], MD4C01, MD4S10);
254 MD4_STEP (MD4_Go, d, a, b, c, w1_t[3], MD4C01, MD4S11);
255 MD4_STEP (MD4_Go, c, d, a, b, w2_t[3], MD4C01, MD4S12);
256 MD4_STEP (MD4_Go, b, c, d, a, w3_t[3], MD4C01, MD4S13);
258 MD4_STEP (MD4_H , a, b, c, d, w0_t[0], MD4C02, MD4S20);
259 MD4_STEP (MD4_H , d, a, b, c, w2_t[0], MD4C02, MD4S21);
260 MD4_STEP (MD4_H , c, d, a, b, w1_t[0], MD4C02, MD4S22);
261 MD4_STEP (MD4_H , b, c, d, a, w3_t[0], MD4C02, MD4S23);
262 MD4_STEP (MD4_H , a, b, c, d, w0_t[2], MD4C02, MD4S20);
263 MD4_STEP (MD4_H , d, a, b, c, w2_t[2], MD4C02, MD4S21);
264 MD4_STEP (MD4_H , c, d, a, b, w1_t[2], MD4C02, MD4S22);
265 MD4_STEP (MD4_H , b, c, d, a, w3_t[2], MD4C02, MD4S23);
266 MD4_STEP (MD4_H , a, b, c, d, w0_t[1], MD4C02, MD4S20);
267 MD4_STEP (MD4_H , d, a, b, c, w2_t[1], MD4C02, MD4S21);
268 MD4_STEP (MD4_H , c, d, a, b, w1_t[1], MD4C02, MD4S22);
269 MD4_STEP (MD4_H , b, c, d, a, w3_t[1], MD4C02, MD4S23);
270 MD4_STEP (MD4_H , a, b, c, d, w0_t[3], MD4C02, MD4S20);
272 if (MATCHES_NONE_VS (a, search[0])) continue;
274 MD4_STEP (MD4_H , d, a, b, c, w2_t[3], MD4C02, MD4S21);
275 MD4_STEP (MD4_H , c, d, a, b, w1_t[3], MD4C02, MD4S22);
276 MD4_STEP (MD4_H , b, c, d, a, w3_t[3], MD4C02, MD4S23);
278 COMPARE_S_SIMD (a, d, c, b);
282 __kernel void m01000_s08 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
286 __kernel void m01000_s16 (__global pw_t *pws, __global kernel_rule_t *rules_buf, __global comb_t *combs_buf, __global bf_t *bfs_buf, __global void *tmps, __global void *hooks, __global u32 *bitmaps_buf_s1_a, __global u32 *bitmaps_buf_s1_b, __global u32 *bitmaps_buf_s1_c, __global u32 *bitmaps_buf_s1_d, __global u32 *bitmaps_buf_s2_a, __global u32 *bitmaps_buf_s2_b, __global u32 *bitmaps_buf_s2_c, __global u32 *bitmaps_buf_s2_d, __global plain_t *plains_buf, __global digest_t *digests_buf, __global u32 *hashes_shown, __global salt_t *salt_bufs, __global void *esalt_bufs, __global u32 *d_return_buf, __global u32 *d_scryptV_buf, const u32 bitmap_mask, const u32 bitmap_shift1, const u32 bitmap_shift2, const u32 salt_pos, const u32 loop_pos, const u32 loop_cnt, const u32 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)