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 "OpenCL/simd.c"
23 __kernel void m00900_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
29 const u32 lid = get_local_id (0);
35 const u32 gid = get_global_id (0);
37 if (gid >= gid_max) return;
42 pws0[0] = pws[gid].i[0];
43 pws0[1] = pws[gid].i[1];
44 pws0[2] = pws[gid].i[2];
45 pws0[3] = pws[gid].i[3];
46 pws1[0] = pws[gid].i[4];
47 pws1[1] = pws[gid].i[5];
48 pws1[2] = pws[gid].i[6];
49 pws1[3] = pws[gid].i[7];
51 const u32 pw_l_len = pws[gid].pw_len;
57 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos += VECT_SIZE)
59 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
61 const u32x pw_len = pw_l_len + pw_r_len;
63 u32x wordr0[4] = { 0 };
64 u32x wordr1[4] = { 0 };
65 u32x wordr2[4] = { 0 };
66 u32x wordr3[4] = { 0 };
68 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
69 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
70 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
71 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
72 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
73 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
74 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
75 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
77 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
79 switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
84 w0[0] = wordl0[0] | wordr0[0];
85 w0[1] = wordl0[1] | wordr0[1];
86 w0[2] = wordl0[2] | wordr0[2];
87 w0[3] = wordl0[3] | wordr0[3];
91 w1[0] = wordl1[0] | wordr1[0];
92 w1[1] = wordl1[1] | wordr1[1];
93 w1[2] = wordl1[2] | wordr1[2];
94 w1[3] = wordl1[3] | wordr1[3];
98 w2[0] = wordl2[0] | wordr2[0];
99 w2[1] = wordl2[1] | wordr2[1];
100 w2[2] = wordl2[2] | wordr2[2];
101 w2[3] = wordl2[3] | wordr2[3];
105 w3[0] = wordl3[0] | wordr3[0];
106 w3[1] = wordl3[1] | wordr3[1];
115 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
116 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
117 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
118 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
119 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
120 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
121 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
122 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
123 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
124 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
125 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
126 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
127 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
128 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
129 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
130 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
132 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
133 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
134 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
135 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
136 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
137 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
138 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
139 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
140 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
141 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
142 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
143 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
144 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
145 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
146 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
147 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
149 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
150 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
151 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
152 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
153 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
154 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
155 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
156 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
157 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
158 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
159 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
160 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
161 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
162 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
163 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
164 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
165 COMPARE_M_SIMD (a, d, c, b);
169 __kernel void m00900_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)
173 __kernel void m00900_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)
177 __kernel void m00900_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
183 const u32 lid = get_local_id (0);
189 const u32 gid = get_global_id (0);
191 if (gid >= gid_max) return;
196 pws0[0] = pws[gid].i[0];
197 pws0[1] = pws[gid].i[1];
198 pws0[2] = pws[gid].i[2];
199 pws0[3] = pws[gid].i[3];
200 pws1[0] = pws[gid].i[4];
201 pws1[1] = pws[gid].i[5];
202 pws1[2] = pws[gid].i[6];
203 pws1[3] = pws[gid].i[7];
205 const u32 pw_l_len = pws[gid].pw_len;
210 const u32 search[4] =
212 digests_buf[digests_offset].digest_buf[DGST_R0],
213 digests_buf[digests_offset].digest_buf[DGST_R1],
214 digests_buf[digests_offset].digest_buf[DGST_R2],
215 digests_buf[digests_offset].digest_buf[DGST_R3]
222 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos += VECT_SIZE)
224 const u32x pw_r_len = pwlenx_create_combt (combs_buf, il_pos);
226 const u32x pw_len = pw_l_len + pw_r_len;
228 u32x wordr0[4] = { 0 };
229 u32x wordr1[4] = { 0 };
230 u32x wordr2[4] = { 0 };
231 u32x wordr3[4] = { 0 };
233 wordr0[0] = ix_create_combt (combs_buf, il_pos, 0);
234 wordr0[1] = ix_create_combt (combs_buf, il_pos, 1);
235 wordr0[2] = ix_create_combt (combs_buf, il_pos, 2);
236 wordr0[3] = ix_create_combt (combs_buf, il_pos, 3);
237 wordr1[0] = ix_create_combt (combs_buf, il_pos, 4);
238 wordr1[1] = ix_create_combt (combs_buf, il_pos, 5);
239 wordr1[2] = ix_create_combt (combs_buf, il_pos, 6);
240 wordr1[3] = ix_create_combt (combs_buf, il_pos, 7);
242 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
244 switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
249 w0[0] = wordl0[0] | wordr0[0];
250 w0[1] = wordl0[1] | wordr0[1];
251 w0[2] = wordl0[2] | wordr0[2];
252 w0[3] = wordl0[3] | wordr0[3];
256 w1[0] = wordl1[0] | wordr1[0];
257 w1[1] = wordl1[1] | wordr1[1];
258 w1[2] = wordl1[2] | wordr1[2];
259 w1[3] = wordl1[3] | wordr1[3];
263 w2[0] = wordl2[0] | wordr2[0];
264 w2[1] = wordl2[1] | wordr2[1];
265 w2[2] = wordl2[2] | wordr2[2];
266 w2[3] = wordl2[3] | wordr2[3];
270 w3[0] = wordl3[0] | wordr3[0];
271 w3[1] = wordl3[1] | wordr3[1];
280 MD4_STEP (MD4_Fo, a, b, c, d, w0[0], MD4C00, MD4S00);
281 MD4_STEP (MD4_Fo, d, a, b, c, w0[1], MD4C00, MD4S01);
282 MD4_STEP (MD4_Fo, c, d, a, b, w0[2], MD4C00, MD4S02);
283 MD4_STEP (MD4_Fo, b, c, d, a, w0[3], MD4C00, MD4S03);
284 MD4_STEP (MD4_Fo, a, b, c, d, w1[0], MD4C00, MD4S00);
285 MD4_STEP (MD4_Fo, d, a, b, c, w1[1], MD4C00, MD4S01);
286 MD4_STEP (MD4_Fo, c, d, a, b, w1[2], MD4C00, MD4S02);
287 MD4_STEP (MD4_Fo, b, c, d, a, w1[3], MD4C00, MD4S03);
288 MD4_STEP (MD4_Fo, a, b, c, d, w2[0], MD4C00, MD4S00);
289 MD4_STEP (MD4_Fo, d, a, b, c, w2[1], MD4C00, MD4S01);
290 MD4_STEP (MD4_Fo, c, d, a, b, w2[2], MD4C00, MD4S02);
291 MD4_STEP (MD4_Fo, b, c, d, a, w2[3], MD4C00, MD4S03);
292 MD4_STEP (MD4_Fo, a, b, c, d, w3[0], MD4C00, MD4S00);
293 MD4_STEP (MD4_Fo, d, a, b, c, w3[1], MD4C00, MD4S01);
294 MD4_STEP (MD4_Fo, c, d, a, b, w3[2], MD4C00, MD4S02);
295 MD4_STEP (MD4_Fo, b, c, d, a, w3[3], MD4C00, MD4S03);
297 MD4_STEP (MD4_Go, a, b, c, d, w0[0], MD4C01, MD4S10);
298 MD4_STEP (MD4_Go, d, a, b, c, w1[0], MD4C01, MD4S11);
299 MD4_STEP (MD4_Go, c, d, a, b, w2[0], MD4C01, MD4S12);
300 MD4_STEP (MD4_Go, b, c, d, a, w3[0], MD4C01, MD4S13);
301 MD4_STEP (MD4_Go, a, b, c, d, w0[1], MD4C01, MD4S10);
302 MD4_STEP (MD4_Go, d, a, b, c, w1[1], MD4C01, MD4S11);
303 MD4_STEP (MD4_Go, c, d, a, b, w2[1], MD4C01, MD4S12);
304 MD4_STEP (MD4_Go, b, c, d, a, w3[1], MD4C01, MD4S13);
305 MD4_STEP (MD4_Go, a, b, c, d, w0[2], MD4C01, MD4S10);
306 MD4_STEP (MD4_Go, d, a, b, c, w1[2], MD4C01, MD4S11);
307 MD4_STEP (MD4_Go, c, d, a, b, w2[2], MD4C01, MD4S12);
308 MD4_STEP (MD4_Go, b, c, d, a, w3[2], MD4C01, MD4S13);
309 MD4_STEP (MD4_Go, a, b, c, d, w0[3], MD4C01, MD4S10);
310 MD4_STEP (MD4_Go, d, a, b, c, w1[3], MD4C01, MD4S11);
311 MD4_STEP (MD4_Go, c, d, a, b, w2[3], MD4C01, MD4S12);
312 MD4_STEP (MD4_Go, b, c, d, a, w3[3], MD4C01, MD4S13);
314 MD4_STEP (MD4_H , a, b, c, d, w0[0], MD4C02, MD4S20);
315 MD4_STEP (MD4_H , d, a, b, c, w2[0], MD4C02, MD4S21);
316 MD4_STEP (MD4_H , c, d, a, b, w1[0], MD4C02, MD4S22);
317 MD4_STEP (MD4_H , b, c, d, a, w3[0], MD4C02, MD4S23);
318 MD4_STEP (MD4_H , a, b, c, d, w0[2], MD4C02, MD4S20);
319 MD4_STEP (MD4_H , d, a, b, c, w2[2], MD4C02, MD4S21);
320 MD4_STEP (MD4_H , c, d, a, b, w1[2], MD4C02, MD4S22);
321 MD4_STEP (MD4_H , b, c, d, a, w3[2], MD4C02, MD4S23);
322 MD4_STEP (MD4_H , a, b, c, d, w0[1], MD4C02, MD4S20);
323 MD4_STEP (MD4_H , d, a, b, c, w2[1], MD4C02, MD4S21);
324 MD4_STEP (MD4_H , c, d, a, b, w1[1], MD4C02, MD4S22);
325 MD4_STEP (MD4_H , b, c, d, a, w3[1], MD4C02, MD4S23);
326 MD4_STEP (MD4_H , a, b, c, d, w0[3], MD4C02, MD4S20);
327 MD4_STEP (MD4_H , d, a, b, c, w2[3], MD4C02, MD4S21);
328 MD4_STEP (MD4_H , c, d, a, b, w1[3], MD4C02, MD4S22);
329 MD4_STEP (MD4_H , b, c, d, a, w3[3], MD4C02, MD4S23);
330 COMPARE_S_SIMD (a, d, c, b);
334 __kernel void m00900_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)
338 __kernel void m00900_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)