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 m03710_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);
101 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
102 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
103 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
104 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
108 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
109 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
110 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
111 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
127 const u32 salt_len = salt_bufs[salt_pos].salt_len;
129 const u32 pw_salt_len = 32 + salt_len;
135 for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
137 const u32 pw_r_len = combs_buf[il_pos].pw_len;
139 const u32 pw_len = pw_l_len + pw_r_len;
143 wordr0[0] = combs_buf[il_pos].i[0];
144 wordr0[1] = combs_buf[il_pos].i[1];
145 wordr0[2] = combs_buf[il_pos].i[2];
146 wordr0[3] = combs_buf[il_pos].i[3];
150 wordr1[0] = combs_buf[il_pos].i[4];
151 wordr1[1] = combs_buf[il_pos].i[5];
152 wordr1[2] = combs_buf[il_pos].i[6];
153 wordr1[3] = combs_buf[il_pos].i[7];
169 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
171 switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
176 w0[0] = wordl0[0] | wordr0[0];
177 w0[1] = wordl0[1] | wordr0[1];
178 w0[2] = wordl0[2] | wordr0[2];
179 w0[3] = wordl0[3] | wordr0[3];
183 w1[0] = wordl1[0] | wordr1[0];
184 w1[1] = wordl1[1] | wordr1[1];
185 w1[2] = wordl1[2] | wordr1[2];
186 w1[3] = wordl1[3] | wordr1[3];
190 w2[0] = wordl2[0] | wordr2[0];
191 w2[1] = wordl2[1] | wordr2[1];
192 w2[2] = wordl2[2] | wordr2[2];
193 w2[3] = wordl2[3] | wordr2[3];
197 w3[0] = wordl3[0] | wordr3[0];
198 w3[1] = wordl3[1] | wordr3[1];
207 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
208 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
209 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
210 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
211 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
212 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
213 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
214 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
215 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
216 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
217 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
218 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
219 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
220 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
221 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
222 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
224 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
225 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
226 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
227 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
228 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
229 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
230 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
231 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
232 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
233 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
234 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
235 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
236 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
237 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
238 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
239 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
241 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
242 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
243 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
244 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
245 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
246 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
247 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
248 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
249 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
250 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
251 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
252 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
253 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
254 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
255 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
256 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
258 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
259 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
260 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
261 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
262 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
263 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
264 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
265 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
266 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
267 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
268 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
269 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
270 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
271 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
272 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
273 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
285 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
286 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
287 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
288 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
289 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
290 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
291 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
292 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
293 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
294 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
295 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
296 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
297 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
298 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
299 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
300 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
302 w2_t[0] = 0x00000080;
316 switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
318 w3_t[2] = pw_salt_len * 8;
320 w0_t[0] |= salt_buf0[0];
321 w0_t[1] |= salt_buf0[1];
322 w0_t[2] |= salt_buf0[2];
323 w0_t[3] |= salt_buf0[3];
324 w1_t[0] |= salt_buf1[0];
325 w1_t[1] |= salt_buf1[1];
326 w1_t[2] |= salt_buf1[2];
327 w1_t[3] |= salt_buf1[3];
328 w2_t[0] |= salt_buf2[0];
329 w2_t[1] |= salt_buf2[1];
330 w2_t[2] |= salt_buf2[2];
331 w2_t[3] |= salt_buf2[3];
332 w3_t[0] |= salt_buf3[0];
333 w3_t[1] |= salt_buf3[1];
334 w3_t[2] |= salt_buf3[2];
335 w3_t[3] |= salt_buf3[3];
346 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
347 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
348 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
349 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
350 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
351 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
352 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
353 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
354 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
355 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
356 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
357 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
358 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
359 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
360 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
361 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
363 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
364 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
365 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
366 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
367 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
368 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
369 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
370 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
371 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
372 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
373 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
374 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
375 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
376 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
377 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
378 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
380 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
381 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
382 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
383 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
384 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
385 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
386 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
387 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
388 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
389 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
390 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
391 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
392 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
393 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
394 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
395 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
397 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
398 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
399 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
400 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
401 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
402 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
403 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
404 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
405 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
406 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
407 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
408 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
409 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
410 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
411 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
412 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
423 __kernel void m03710_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)
427 __kernel void m03710_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)
431 __kernel void m03710_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)
437 const u32 gid = get_global_id (0);
438 const u32 lid = get_local_id (0);
439 const u32 lsz = get_local_size (0);
445 __local u32 l_bin2asc[256];
447 for (u32 i = lid; i < 256; i += lsz)
449 const u32 i0 = (i >> 0) & 15;
450 const u32 i1 = (i >> 4) & 15;
452 l_bin2asc[i] = ((i0 < 10) ? '0' + i0 : 'a' - 10 + i0) << 8
453 | ((i1 < 10) ? '0' + i1 : 'a' - 10 + i1) << 0;
456 barrier (CLK_LOCAL_MEM_FENCE);
458 if (gid >= gid_max) return;
466 wordl0[0] = pws[gid].i[ 0];
467 wordl0[1] = pws[gid].i[ 1];
468 wordl0[2] = pws[gid].i[ 2];
469 wordl0[3] = pws[gid].i[ 3];
473 wordl1[0] = pws[gid].i[ 4];
474 wordl1[1] = pws[gid].i[ 5];
475 wordl1[2] = pws[gid].i[ 6];
476 wordl1[3] = pws[gid].i[ 7];
492 const u32 pw_l_len = pws[gid].pw_len;
494 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
496 append_0x80_2x4 (wordl0, wordl1, pw_l_len);
498 switch_buffer_by_offset_le (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
507 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
508 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
509 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
510 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
514 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
515 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
516 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
517 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
533 const u32 salt_len = salt_bufs[salt_pos].salt_len;
535 const u32 pw_salt_len = 32 + salt_len;
541 const u32 search[4] =
543 digests_buf[digests_offset].digest_buf[DGST_R0],
544 digests_buf[digests_offset].digest_buf[DGST_R1],
545 digests_buf[digests_offset].digest_buf[DGST_R2],
546 digests_buf[digests_offset].digest_buf[DGST_R3]
553 for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
555 const u32 pw_r_len = combs_buf[il_pos].pw_len;
557 const u32 pw_len = pw_l_len + pw_r_len;
561 wordr0[0] = combs_buf[il_pos].i[0];
562 wordr0[1] = combs_buf[il_pos].i[1];
563 wordr0[2] = combs_buf[il_pos].i[2];
564 wordr0[3] = combs_buf[il_pos].i[3];
568 wordr1[0] = combs_buf[il_pos].i[4];
569 wordr1[1] = combs_buf[il_pos].i[5];
570 wordr1[2] = combs_buf[il_pos].i[6];
571 wordr1[3] = combs_buf[il_pos].i[7];
587 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
589 switch_buffer_by_offset_le (wordr0, wordr1, wordr2, wordr3, pw_l_len);
594 w0[0] = wordl0[0] | wordr0[0];
595 w0[1] = wordl0[1] | wordr0[1];
596 w0[2] = wordl0[2] | wordr0[2];
597 w0[3] = wordl0[3] | wordr0[3];
601 w1[0] = wordl1[0] | wordr1[0];
602 w1[1] = wordl1[1] | wordr1[1];
603 w1[2] = wordl1[2] | wordr1[2];
604 w1[3] = wordl1[3] | wordr1[3];
608 w2[0] = wordl2[0] | wordr2[0];
609 w2[1] = wordl2[1] | wordr2[1];
610 w2[2] = wordl2[2] | wordr2[2];
611 w2[3] = wordl2[3] | wordr2[3];
615 w3[0] = wordl3[0] | wordr3[0];
616 w3[1] = wordl3[1] | wordr3[1];
625 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
626 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
627 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
628 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
629 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
630 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
631 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
632 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
633 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
634 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
635 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
636 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
637 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
638 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
639 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
640 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
642 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
643 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
644 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
645 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
646 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
647 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
648 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
649 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
650 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
651 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
652 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
653 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
654 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
655 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
656 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
657 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
659 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
660 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
661 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
662 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
663 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
664 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
665 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
666 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
667 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
668 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
669 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
670 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
671 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
672 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
673 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
674 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
676 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
677 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
678 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
679 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
680 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
681 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
682 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
683 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
684 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
685 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
686 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
687 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
688 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
689 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
690 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
691 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
703 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
704 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
705 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
706 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
707 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
708 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
709 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
710 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
711 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
712 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
713 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
714 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
715 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
716 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
717 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
718 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
720 w2_t[0] = 0x00000080;
734 switch_buffer_by_offset_le (w0_t, w1_t, w2_t, w3_t, salt_len);
736 w3_t[2] = pw_salt_len * 8;
738 w0_t[0] |= salt_buf0[0];
739 w0_t[1] |= salt_buf0[1];
740 w0_t[2] |= salt_buf0[2];
741 w0_t[3] |= salt_buf0[3];
742 w1_t[0] |= salt_buf1[0];
743 w1_t[1] |= salt_buf1[1];
744 w1_t[2] |= salt_buf1[2];
745 w1_t[3] |= salt_buf1[3];
746 w2_t[0] |= salt_buf2[0];
747 w2_t[1] |= salt_buf2[1];
748 w2_t[2] |= salt_buf2[2];
749 w2_t[3] |= salt_buf2[3];
750 w3_t[0] |= salt_buf3[0];
751 w3_t[1] |= salt_buf3[1];
752 w3_t[2] |= salt_buf3[2];
753 w3_t[3] |= salt_buf3[3];
764 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
765 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
766 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
767 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
768 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
769 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
770 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
771 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
772 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
773 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
774 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
775 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
776 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
777 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
778 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
779 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
781 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
782 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
783 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
784 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
785 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
786 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
787 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
788 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
789 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
790 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
791 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
792 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
793 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
794 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
795 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
796 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
798 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
799 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
800 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
801 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
802 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
803 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
804 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
805 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
806 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
807 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
808 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
809 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
810 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
811 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
812 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
813 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
815 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
816 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
817 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
818 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
819 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
820 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
821 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
822 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
823 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
824 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
825 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
826 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
827 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
828 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
829 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
830 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
841 __kernel void m03710_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)
845 __kernel void m03710_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)