2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
16 #include "include/kernel_functions.c"
17 #include "OpenCL/types_ocl.c"
18 #include "OpenCL/common.c"
20 #define COMPARE_S "OpenCL/check_single_comp4.c"
21 #define COMPARE_M "OpenCL/check_multi_comp4.c"
23 #define uint_to_hex_lower8(i) l_bin2asc[(i)]
25 __kernel void m04310_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
31 const u32 gid = get_global_id (0);
32 const u32 lid = get_local_id (0);
33 const u32 lsz = get_local_size (0);
39 __local u32 l_bin2asc[256];
41 for (u32 i = lid; i < 256; i += lsz)
43 const u32 i0 = (i >> 0) & 15;
44 const u32 i1 = (i >> 4) & 15;
46 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'A' - 10 + i0) << 8
47 | ((i1 < 10) ? '0' + i1 : 'A' - 10 + i1) << 0;
50 barrier (CLK_LOCAL_MEM_FENCE);
52 if (gid >= gid_max) return;
60 wordl0[0] = pws[gid].i[ 0];
61 wordl0[1] = pws[gid].i[ 1];
62 wordl0[2] = pws[gid].i[ 2];
63 wordl0[3] = pws[gid].i[ 3];
67 wordl1[0] = pws[gid].i[ 4];
68 wordl1[1] = pws[gid].i[ 5];
69 wordl1[2] = pws[gid].i[ 6];
70 wordl1[3] = pws[gid].i[ 7];
86 const u32 pw_l_len = pws[gid].pw_len;
88 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
90 append_0x80_2x4 (wordl0, wordl1, pw_l_len);
92 switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
99 const u32 salt_len = salt_bufs[salt_pos].salt_len;
103 s[0] = salt_bufs[salt_pos].salt_buf[0];
104 s[1] = salt_bufs[salt_pos].salt_buf[1];
105 s[2] = salt_bufs[salt_pos].salt_buf[2];
106 s[3] = salt_bufs[salt_pos].salt_buf[3];
107 s[4] = salt_bufs[salt_pos].salt_buf[4];
108 s[5] = salt_bufs[salt_pos].salt_buf[5];
109 s[6] = (32 + salt_len) * 8;
116 for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
118 const u32 pw_r_len = combs_buf[il_pos].pw_len;
120 const u32 pw_len = pw_l_len + pw_r_len;
124 wordr0[0] = combs_buf[il_pos].i[0];
125 wordr0[1] = combs_buf[il_pos].i[1];
126 wordr0[2] = combs_buf[il_pos].i[2];
127 wordr0[3] = combs_buf[il_pos].i[3];
131 wordr1[0] = combs_buf[il_pos].i[4];
132 wordr1[1] = combs_buf[il_pos].i[5];
133 wordr1[2] = combs_buf[il_pos].i[6];
134 wordr1[3] = combs_buf[il_pos].i[7];
150 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
152 switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
157 w0[0] = wordl0[0] | wordr0[0];
158 w0[1] = wordl0[1] | wordr0[1];
159 w0[2] = wordl0[2] | wordr0[2];
160 w0[3] = wordl0[3] | wordr0[3];
164 w1[0] = wordl1[0] | wordr1[0];
165 w1[1] = wordl1[1] | wordr1[1];
166 w1[2] = wordl1[2] | wordr1[2];
167 w1[3] = wordl1[3] | wordr1[3];
171 w2[0] = wordl2[0] | wordr2[0];
172 w2[1] = wordl2[1] | wordr2[1];
173 w2[2] = wordl2[2] | wordr2[2];
174 w2[3] = wordl2[3] | wordr2[3];
178 w3[0] = wordl3[0] | wordr3[0];
179 w3[1] = wordl3[1] | wordr3[1];
188 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
189 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
190 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
191 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
192 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
193 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
194 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
195 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
196 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
197 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
198 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
199 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
200 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
201 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
202 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
203 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
205 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
206 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
207 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
208 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
209 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
210 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
211 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
212 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
213 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
214 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
215 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
216 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
217 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
218 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
219 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
220 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
222 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
223 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
224 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
225 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
226 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
227 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
228 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
229 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
230 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
231 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
232 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
233 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
234 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
235 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
236 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
237 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
239 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
240 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
241 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
242 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
243 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
244 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
245 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
246 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
247 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
248 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
249 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
250 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
251 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
252 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
253 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
254 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
261 const u32 w0_t = uint_to_hex_lower8 ((a >> 0) & 255) << 0
262 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
263 const u32 w1_t = uint_to_hex_lower8 ((a >> 16) & 255) << 0
264 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
265 const u32 w2_t = uint_to_hex_lower8 ((b >> 0) & 255) << 0
266 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
267 const u32 w3_t = uint_to_hex_lower8 ((b >> 16) & 255) << 0
268 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
269 const u32 w4_t = uint_to_hex_lower8 ((c >> 0) & 255) << 0
270 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
271 const u32 w5_t = uint_to_hex_lower8 ((c >> 16) & 255) << 0
272 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
273 const u32 w6_t = uint_to_hex_lower8 ((d >> 0) & 255) << 0
274 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
275 const u32 w7_t = uint_to_hex_lower8 ((d >> 16) & 255) << 0
276 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
278 const u32 w8_t = s[0];
279 const u32 w9_t = s[1];
280 const u32 wa_t = s[2];
281 const u32 wb_t = s[3];
282 const u32 wc_t = s[4];
283 const u32 wd_t = s[5];
284 const u32 we_t = s[6];
285 const u32 wf_t = s[7];
292 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
293 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
294 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
295 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
296 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
297 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
298 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
299 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
300 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
301 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
302 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
303 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
304 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
305 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
306 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
307 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
309 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
310 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
311 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
312 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
313 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
314 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
315 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
316 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
317 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
318 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
319 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
320 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
321 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
322 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
323 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
324 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
326 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
327 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
328 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
329 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
330 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
331 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
332 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
333 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
334 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
335 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
336 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
337 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
338 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
339 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
340 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
341 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
343 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
344 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
345 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
346 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
347 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
348 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
349 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
350 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
351 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
352 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
353 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
354 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
355 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
356 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
357 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
358 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
369 __kernel void m04310_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
373 __kernel void m04310_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
377 __kernel void m04310_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
383 const u32 gid = get_global_id (0);
384 const u32 lid = get_local_id (0);
385 const u32 lsz = get_local_size (0);
391 __local u32 l_bin2asc[256];
393 for (u32 i = lid; i < 256; i += lsz)
395 const u32 i0 = (i >> 0) & 15;
396 const u32 i1 = (i >> 4) & 15;
398 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'A' - 10 + i0) << 8
399 | ((i1 < 10) ? '0' + i1 : 'A' - 10 + i1) << 0;
402 barrier (CLK_LOCAL_MEM_FENCE);
404 if (gid >= gid_max) return;
412 wordl0[0] = pws[gid].i[ 0];
413 wordl0[1] = pws[gid].i[ 1];
414 wordl0[2] = pws[gid].i[ 2];
415 wordl0[3] = pws[gid].i[ 3];
419 wordl1[0] = pws[gid].i[ 4];
420 wordl1[1] = pws[gid].i[ 5];
421 wordl1[2] = pws[gid].i[ 6];
422 wordl1[3] = pws[gid].i[ 7];
438 const u32 pw_l_len = pws[gid].pw_len;
440 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
442 append_0x80_2x4 (wordl0, wordl1, pw_l_len);
444 switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
451 const u32 search[4] =
453 digests_buf[digests_offset].digest_buf[DGST_R0],
454 digests_buf[digests_offset].digest_buf[DGST_R1],
455 digests_buf[digests_offset].digest_buf[DGST_R2],
456 digests_buf[digests_offset].digest_buf[DGST_R3]
463 const u32 salt_len = salt_bufs[salt_pos].salt_len;
467 s[0] = salt_bufs[salt_pos].salt_buf[0];
468 s[1] = salt_bufs[salt_pos].salt_buf[1];
469 s[2] = salt_bufs[salt_pos].salt_buf[2];
470 s[3] = salt_bufs[salt_pos].salt_buf[3];
471 s[4] = salt_bufs[salt_pos].salt_buf[4];
472 s[5] = salt_bufs[salt_pos].salt_buf[5];
473 s[6] = (32 + salt_len) * 8;
480 for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
482 const u32 pw_r_len = combs_buf[il_pos].pw_len;
484 const u32 pw_len = pw_l_len + pw_r_len;
488 wordr0[0] = combs_buf[il_pos].i[0];
489 wordr0[1] = combs_buf[il_pos].i[1];
490 wordr0[2] = combs_buf[il_pos].i[2];
491 wordr0[3] = combs_buf[il_pos].i[3];
495 wordr1[0] = combs_buf[il_pos].i[4];
496 wordr1[1] = combs_buf[il_pos].i[5];
497 wordr1[2] = combs_buf[il_pos].i[6];
498 wordr1[3] = combs_buf[il_pos].i[7];
514 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
516 switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
521 w0[0] = wordl0[0] | wordr0[0];
522 w0[1] = wordl0[1] | wordr0[1];
523 w0[2] = wordl0[2] | wordr0[2];
524 w0[3] = wordl0[3] | wordr0[3];
528 w1[0] = wordl1[0] | wordr1[0];
529 w1[1] = wordl1[1] | wordr1[1];
530 w1[2] = wordl1[2] | wordr1[2];
531 w1[3] = wordl1[3] | wordr1[3];
535 w2[0] = wordl2[0] | wordr2[0];
536 w2[1] = wordl2[1] | wordr2[1];
537 w2[2] = wordl2[2] | wordr2[2];
538 w2[3] = wordl2[3] | wordr2[3];
542 w3[0] = wordl3[0] | wordr3[0];
543 w3[1] = wordl3[1] | wordr3[1];
552 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
553 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
554 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
555 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
556 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
557 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
558 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
559 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
560 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
561 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
562 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
563 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
564 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
565 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
566 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
567 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
569 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
570 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
571 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
572 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
573 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
574 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
575 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
576 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
577 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
578 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
579 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
580 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
581 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
582 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
583 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
584 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
586 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
587 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
588 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
589 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
590 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
591 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
592 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
593 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
594 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
595 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
596 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
597 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
598 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
599 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
600 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
601 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
603 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
604 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
605 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
606 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
607 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
608 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
609 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
610 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
611 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
612 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
613 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
614 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
615 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
616 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
617 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
618 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
625 const u32 w0_t = uint_to_hex_lower8 ((a >> 0) & 255) << 0
626 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
627 const u32 w1_t = uint_to_hex_lower8 ((a >> 16) & 255) << 0
628 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
629 const u32 w2_t = uint_to_hex_lower8 ((b >> 0) & 255) << 0
630 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
631 const u32 w3_t = uint_to_hex_lower8 ((b >> 16) & 255) << 0
632 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
633 const u32 w4_t = uint_to_hex_lower8 ((c >> 0) & 255) << 0
634 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
635 const u32 w5_t = uint_to_hex_lower8 ((c >> 16) & 255) << 0
636 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
637 const u32 w6_t = uint_to_hex_lower8 ((d >> 0) & 255) << 0
638 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
639 const u32 w7_t = uint_to_hex_lower8 ((d >> 16) & 255) << 0
640 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
642 const u32 w8_t = s[0];
643 const u32 w9_t = s[1];
644 const u32 wa_t = s[2];
645 const u32 wb_t = s[3];
646 const u32 wc_t = s[4];
647 const u32 wd_t = s[5];
648 const u32 we_t = s[6];
649 const u32 wf_t = s[7];
656 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
657 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
658 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
659 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
660 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
661 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
662 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
663 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
664 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
665 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
666 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
667 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
668 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
669 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
670 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
671 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
673 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
674 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
675 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
676 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
677 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
678 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
679 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
680 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
681 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
682 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
683 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
684 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
685 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
686 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
687 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
688 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
690 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
691 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
692 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
693 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
694 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
695 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
696 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
697 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
698 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
699 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
700 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
701 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
702 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
703 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
704 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
705 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
707 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
708 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
709 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
710 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
711 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
712 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
713 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
714 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
715 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
716 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
717 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
718 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
719 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
720 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
721 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
722 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
733 __kernel void m04310_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
737 __kernel void m04310_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 il_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)