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 "types_ocl.c"
20 #define COMPARE_S "check_single_comp4.c"
21 #define COMPARE_M "check_multi_comp4.c"
24 #define uint_to_hex_lower8(i) l_bin2asc[(i)]
28 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1])
32 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3])
35 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m02610_m04 (__global pw_t *pws, __global gpu_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)
41 const u32 lid = get_local_id (0);
47 const u32 gid = get_global_id (0);
51 wordl0[0] = pws[gid].i[ 0];
52 wordl0[1] = pws[gid].i[ 1];
53 wordl0[2] = pws[gid].i[ 2];
54 wordl0[3] = pws[gid].i[ 3];
58 wordl1[0] = pws[gid].i[ 4];
59 wordl1[1] = pws[gid].i[ 5];
60 wordl1[2] = pws[gid].i[ 6];
61 wordl1[3] = pws[gid].i[ 7];
77 const u32 pw_l_len = pws[gid].pw_len;
79 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
81 append_0x80_2x4 (wordl0, wordl1, pw_l_len);
83 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
90 const u32 salt_len = salt_bufs[salt_pos].salt_len;
94 s[0] = salt_bufs[salt_pos].salt_buf[0];
95 s[1] = salt_bufs[salt_pos].salt_buf[1];
96 s[2] = salt_bufs[salt_pos].salt_buf[2];
97 s[3] = salt_bufs[salt_pos].salt_buf[3];
98 s[4] = salt_bufs[salt_pos].salt_buf[4];
99 s[5] = salt_bufs[salt_pos].salt_buf[5];
100 s[6] = (32 + salt_len) * 8;
107 __local u32 l_bin2asc[256];
109 const u32 lid4 = lid * 4;
111 const u32 lid40 = lid4 + 0;
112 const u32 lid41 = lid4 + 1;
113 const u32 lid42 = lid4 + 2;
114 const u32 lid43 = lid4 + 3;
116 const u32 v400 = (lid40 >> 0) & 15;
117 const u32 v401 = (lid40 >> 4) & 15;
118 const u32 v410 = (lid41 >> 0) & 15;
119 const u32 v411 = (lid41 >> 4) & 15;
120 const u32 v420 = (lid42 >> 0) & 15;
121 const u32 v421 = (lid42 >> 4) & 15;
122 const u32 v430 = (lid43 >> 0) & 15;
123 const u32 v431 = (lid43 >> 4) & 15;
125 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
126 | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
127 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
128 | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
129 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
130 | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
131 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
132 | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
134 barrier (CLK_LOCAL_MEM_FENCE);
136 if (gid >= gid_max) return;
142 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
144 const u32 pw_r_len = combs_buf[il_pos].pw_len;
146 const u32 pw_len = pw_l_len + pw_r_len;
150 wordr0[0] = combs_buf[il_pos].i[0];
151 wordr0[1] = combs_buf[il_pos].i[1];
152 wordr0[2] = combs_buf[il_pos].i[2];
153 wordr0[3] = combs_buf[il_pos].i[3];
157 wordr1[0] = combs_buf[il_pos].i[4];
158 wordr1[1] = combs_buf[il_pos].i[5];
159 wordr1[2] = combs_buf[il_pos].i[6];
160 wordr1[3] = combs_buf[il_pos].i[7];
176 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
178 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
183 w0[0] = wordl0[0] | wordr0[0];
184 w0[1] = wordl0[1] | wordr0[1];
185 w0[2] = wordl0[2] | wordr0[2];
186 w0[3] = wordl0[3] | wordr0[3];
190 w1[0] = wordl1[0] | wordr1[0];
191 w1[1] = wordl1[1] | wordr1[1];
192 w1[2] = wordl1[2] | wordr1[2];
193 w1[3] = wordl1[3] | wordr1[3];
197 w2[0] = wordl2[0] | wordr2[0];
198 w2[1] = wordl2[1] | wordr2[1];
199 w2[2] = wordl2[2] | wordr2[2];
200 w2[3] = wordl2[3] | wordr2[3];
204 w3[0] = wordl3[0] | wordr3[0];
205 w3[1] = wordl3[1] | wordr3[1];
214 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
215 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
216 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
217 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
218 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
219 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
220 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
221 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
222 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
223 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
224 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
225 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
226 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
227 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
228 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
229 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
231 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
232 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
233 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
234 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
235 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
236 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
237 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
238 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
239 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
240 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
241 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
242 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
243 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
244 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
245 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
246 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
248 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
249 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
250 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
251 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
252 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
253 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
254 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
255 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
256 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
257 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
258 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
259 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
260 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
261 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
262 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
263 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
265 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
266 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
267 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
268 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
269 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
270 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
271 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
272 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
273 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
274 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
275 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
276 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
277 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
278 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
279 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
280 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
287 const u32 w0_t = uint_to_hex_lower8 ((a >> 0) & 255) << 0
288 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
289 const u32 w1_t = uint_to_hex_lower8 ((a >> 16) & 255) << 0
290 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
291 const u32 w2_t = uint_to_hex_lower8 ((b >> 0) & 255) << 0
292 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
293 const u32 w3_t = uint_to_hex_lower8 ((b >> 16) & 255) << 0
294 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
295 const u32 w4_t = uint_to_hex_lower8 ((c >> 0) & 255) << 0
296 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
297 const u32 w5_t = uint_to_hex_lower8 ((c >> 16) & 255) << 0
298 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
299 const u32 w6_t = uint_to_hex_lower8 ((d >> 0) & 255) << 0
300 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
301 const u32 w7_t = uint_to_hex_lower8 ((d >> 16) & 255) << 0
302 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
304 const u32 w8_t = s[0];
305 const u32 w9_t = s[1];
306 const u32 wa_t = s[2];
307 const u32 wb_t = s[3];
308 const u32 wc_t = s[4];
309 const u32 wd_t = s[5];
310 const u32 we_t = s[6];
311 const u32 wf_t = s[7];
318 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
319 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
320 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
321 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
322 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
323 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
324 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
325 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
326 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
327 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
328 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
329 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
330 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
331 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
332 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
333 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
335 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
336 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
337 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
338 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
339 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
340 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
341 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
342 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
343 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
344 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
345 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
346 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
347 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
348 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
349 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
350 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
352 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
353 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
354 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
355 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
356 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
357 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
358 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
359 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
360 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
361 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
362 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
363 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
364 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
365 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
366 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
367 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
369 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
370 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
371 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
372 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
373 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
374 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
375 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
376 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
377 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
378 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
379 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
380 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
381 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
382 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
383 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
384 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
395 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m02610_m08 (__global pw_t *pws, __global gpu_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)
399 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m02610_m16 (__global pw_t *pws, __global gpu_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)
403 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m02610_s04 (__global pw_t *pws, __global gpu_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)
409 const u32 lid = get_local_id (0);
415 const u32 gid = get_global_id (0);
419 wordl0[0] = pws[gid].i[ 0];
420 wordl0[1] = pws[gid].i[ 1];
421 wordl0[2] = pws[gid].i[ 2];
422 wordl0[3] = pws[gid].i[ 3];
426 wordl1[0] = pws[gid].i[ 4];
427 wordl1[1] = pws[gid].i[ 5];
428 wordl1[2] = pws[gid].i[ 6];
429 wordl1[3] = pws[gid].i[ 7];
445 const u32 pw_l_len = pws[gid].pw_len;
447 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
449 append_0x80_2x4 (wordl0, wordl1, pw_l_len);
451 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
458 const u32 search[4] =
460 digests_buf[digests_offset].digest_buf[DGST_R0],
461 digests_buf[digests_offset].digest_buf[DGST_R1],
462 digests_buf[digests_offset].digest_buf[DGST_R2],
463 digests_buf[digests_offset].digest_buf[DGST_R3]
470 const u32 salt_len = salt_bufs[salt_pos].salt_len;
474 s[0] = salt_bufs[salt_pos].salt_buf[0];
475 s[1] = salt_bufs[salt_pos].salt_buf[1];
476 s[2] = salt_bufs[salt_pos].salt_buf[2];
477 s[3] = salt_bufs[salt_pos].salt_buf[3];
478 s[4] = salt_bufs[salt_pos].salt_buf[4];
479 s[5] = salt_bufs[salt_pos].salt_buf[5];
480 s[6] = (32 + salt_len) * 8;
487 __local u32 l_bin2asc[256];
489 const u32 lid4 = lid * 4;
491 const u32 lid40 = lid4 + 0;
492 const u32 lid41 = lid4 + 1;
493 const u32 lid42 = lid4 + 2;
494 const u32 lid43 = lid4 + 3;
496 const u32 v400 = (lid40 >> 0) & 15;
497 const u32 v401 = (lid40 >> 4) & 15;
498 const u32 v410 = (lid41 >> 0) & 15;
499 const u32 v411 = (lid41 >> 4) & 15;
500 const u32 v420 = (lid42 >> 0) & 15;
501 const u32 v421 = (lid42 >> 4) & 15;
502 const u32 v430 = (lid43 >> 0) & 15;
503 const u32 v431 = (lid43 >> 4) & 15;
505 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
506 | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
507 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
508 | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
509 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
510 | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
511 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
512 | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
514 barrier (CLK_LOCAL_MEM_FENCE);
516 if (gid >= gid_max) return;
522 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
524 const u32 pw_r_len = combs_buf[il_pos].pw_len;
526 const u32 pw_len = pw_l_len + pw_r_len;
530 wordr0[0] = combs_buf[il_pos].i[0];
531 wordr0[1] = combs_buf[il_pos].i[1];
532 wordr0[2] = combs_buf[il_pos].i[2];
533 wordr0[3] = combs_buf[il_pos].i[3];
537 wordr1[0] = combs_buf[il_pos].i[4];
538 wordr1[1] = combs_buf[il_pos].i[5];
539 wordr1[2] = combs_buf[il_pos].i[6];
540 wordr1[3] = combs_buf[il_pos].i[7];
556 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
558 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
563 w0[0] = wordl0[0] | wordr0[0];
564 w0[1] = wordl0[1] | wordr0[1];
565 w0[2] = wordl0[2] | wordr0[2];
566 w0[3] = wordl0[3] | wordr0[3];
570 w1[0] = wordl1[0] | wordr1[0];
571 w1[1] = wordl1[1] | wordr1[1];
572 w1[2] = wordl1[2] | wordr1[2];
573 w1[3] = wordl1[3] | wordr1[3];
577 w2[0] = wordl2[0] | wordr2[0];
578 w2[1] = wordl2[1] | wordr2[1];
579 w2[2] = wordl2[2] | wordr2[2];
580 w2[3] = wordl2[3] | wordr2[3];
584 w3[0] = wordl3[0] | wordr3[0];
585 w3[1] = wordl3[1] | wordr3[1];
594 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
595 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
596 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
597 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
598 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
599 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
600 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
601 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
602 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
603 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
604 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
605 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
606 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
607 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
608 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
609 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
611 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
612 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
613 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
614 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
615 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
616 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
617 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
618 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
619 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
620 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
621 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
622 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
623 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
624 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
625 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
626 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
628 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
629 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
630 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
631 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
632 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
633 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
634 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
635 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
636 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
637 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
638 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
639 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
640 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
641 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
642 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
643 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
645 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
646 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
647 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
648 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
649 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
650 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
651 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
652 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
653 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
654 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
655 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
656 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
657 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
658 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
659 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
660 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
667 const u32 w0_t = uint_to_hex_lower8 ((a >> 0) & 255) << 0
668 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
669 const u32 w1_t = uint_to_hex_lower8 ((a >> 16) & 255) << 0
670 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
671 const u32 w2_t = uint_to_hex_lower8 ((b >> 0) & 255) << 0
672 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
673 const u32 w3_t = uint_to_hex_lower8 ((b >> 16) & 255) << 0
674 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
675 const u32 w4_t = uint_to_hex_lower8 ((c >> 0) & 255) << 0
676 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
677 const u32 w5_t = uint_to_hex_lower8 ((c >> 16) & 255) << 0
678 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
679 const u32 w6_t = uint_to_hex_lower8 ((d >> 0) & 255) << 0
680 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
681 const u32 w7_t = uint_to_hex_lower8 ((d >> 16) & 255) << 0
682 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
684 const u32 w8_t = s[0];
685 const u32 w9_t = s[1];
686 const u32 wa_t = s[2];
687 const u32 wb_t = s[3];
688 const u32 wc_t = s[4];
689 const u32 wd_t = s[5];
690 const u32 we_t = s[6];
691 const u32 wf_t = s[7];
698 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
699 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
700 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
701 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
702 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
703 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
704 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
705 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
706 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
707 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
708 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
709 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
710 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
711 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
712 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
713 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
715 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
716 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
717 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
718 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
719 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
720 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
721 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
722 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
723 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
724 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
725 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
726 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
727 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
728 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
729 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
730 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
732 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
733 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
734 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
735 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
736 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
737 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
738 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
739 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
740 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
741 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
742 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
743 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
744 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
745 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
746 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
747 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
749 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
750 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
751 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
752 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
753 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
754 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
755 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
756 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
757 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
758 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
759 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
760 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
761 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
762 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
763 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
764 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
775 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m02610_s08 (__global pw_t *pws, __global gpu_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)
779 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m02610_s16 (__global pw_t *pws, __global gpu_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)