2 * Author......: Jens Steube <jens.steube@gmail.com>
8 #include "include/constants.h"
9 #include "include/kernel_vendor.h"
28 #include "include/kernel_functions.c"
29 #include "types_amd.c"
30 #include "common_amd.c"
33 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
34 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
38 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
39 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
43 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
44 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
48 #define uint_to_hex_lower8(i) l_bin2asc[(i)]
52 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1])
56 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3])
59 __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)
65 const u32 lid = get_local_id (0);
71 const u32 gid = get_global_id (0);
75 wordl0[0] = pws[gid].i[ 0];
76 wordl0[1] = pws[gid].i[ 1];
77 wordl0[2] = pws[gid].i[ 2];
78 wordl0[3] = pws[gid].i[ 3];
82 wordl1[0] = pws[gid].i[ 4];
83 wordl1[1] = pws[gid].i[ 5];
84 wordl1[2] = pws[gid].i[ 6];
85 wordl1[3] = pws[gid].i[ 7];
101 const u32 pw_l_len = pws[gid].pw_len;
103 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
105 append_0x80_2 (wordl0, wordl1, pw_l_len);
107 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
114 const u32 salt_len = salt_bufs[salt_pos].salt_len;
118 s[0] = salt_bufs[salt_pos].salt_buf[0];
119 s[1] = salt_bufs[salt_pos].salt_buf[1];
120 s[2] = salt_bufs[salt_pos].salt_buf[2];
121 s[3] = salt_bufs[salt_pos].salt_buf[3];
122 s[4] = salt_bufs[salt_pos].salt_buf[4];
123 s[5] = salt_bufs[salt_pos].salt_buf[5];
124 s[6] = (32 + salt_len) * 8;
131 __local u32 l_bin2asc[256];
133 const u32 lid4 = lid * 4;
135 const u32 lid40 = lid4 + 0;
136 const u32 lid41 = lid4 + 1;
137 const u32 lid42 = lid4 + 2;
138 const u32 lid43 = lid4 + 3;
140 const u32 v400 = (lid40 >> 0) & 15;
141 const u32 v401 = (lid40 >> 4) & 15;
142 const u32 v410 = (lid41 >> 0) & 15;
143 const u32 v411 = (lid41 >> 4) & 15;
144 const u32 v420 = (lid42 >> 0) & 15;
145 const u32 v421 = (lid42 >> 4) & 15;
146 const u32 v430 = (lid43 >> 0) & 15;
147 const u32 v431 = (lid43 >> 4) & 15;
149 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
150 | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
151 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
152 | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
153 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
154 | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
155 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
156 | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
158 barrier (CLK_LOCAL_MEM_FENCE);
160 if (gid >= gid_max) return;
166 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
168 const u32 pw_r_len = combs_buf[il_pos].pw_len;
170 const u32 pw_len = pw_l_len + pw_r_len;
174 wordr0[0] = combs_buf[il_pos].i[0];
175 wordr0[1] = combs_buf[il_pos].i[1];
176 wordr0[2] = combs_buf[il_pos].i[2];
177 wordr0[3] = combs_buf[il_pos].i[3];
181 wordr1[0] = combs_buf[il_pos].i[4];
182 wordr1[1] = combs_buf[il_pos].i[5];
183 wordr1[2] = combs_buf[il_pos].i[6];
184 wordr1[3] = combs_buf[il_pos].i[7];
200 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
202 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
207 w0[0] = wordl0[0] | wordr0[0];
208 w0[1] = wordl0[1] | wordr0[1];
209 w0[2] = wordl0[2] | wordr0[2];
210 w0[3] = wordl0[3] | wordr0[3];
214 w1[0] = wordl1[0] | wordr1[0];
215 w1[1] = wordl1[1] | wordr1[1];
216 w1[2] = wordl1[2] | wordr1[2];
217 w1[3] = wordl1[3] | wordr1[3];
221 w2[0] = wordl2[0] | wordr2[0];
222 w2[1] = wordl2[1] | wordr2[1];
223 w2[2] = wordl2[2] | wordr2[2];
224 w2[3] = wordl2[3] | wordr2[3];
228 w3[0] = wordl3[0] | wordr3[0];
229 w3[1] = wordl3[1] | wordr3[1];
238 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
239 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
240 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
241 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
242 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
243 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
244 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
245 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
246 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
247 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
248 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
249 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
250 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
251 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
252 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
253 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
255 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
256 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
257 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
258 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
259 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
260 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
261 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
262 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
263 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
264 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
265 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
266 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
267 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
268 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
269 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
270 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
272 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
273 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
274 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
275 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
276 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
277 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
278 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
279 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
280 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
281 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
282 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
283 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
284 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
285 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
286 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
287 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
289 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
290 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
291 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
292 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
293 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
294 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
295 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
296 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
297 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
298 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
299 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
300 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
301 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
302 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
303 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
304 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
311 const u32x w0_t = uint_to_hex_lower8 ((a >> 0) & 255) << 0
312 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
313 const u32x w1_t = uint_to_hex_lower8 ((a >> 16) & 255) << 0
314 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
315 const u32x w2_t = uint_to_hex_lower8 ((b >> 0) & 255) << 0
316 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
317 const u32x w3_t = uint_to_hex_lower8 ((b >> 16) & 255) << 0
318 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
319 const u32x w4_t = uint_to_hex_lower8 ((c >> 0) & 255) << 0
320 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
321 const u32x w5_t = uint_to_hex_lower8 ((c >> 16) & 255) << 0
322 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
323 const u32x w6_t = uint_to_hex_lower8 ((d >> 0) & 255) << 0
324 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
325 const u32x w7_t = uint_to_hex_lower8 ((d >> 16) & 255) << 0
326 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
328 const u32 w8_t = s[0];
329 const u32 w9_t = s[1];
330 const u32 wa_t = s[2];
331 const u32 wb_t = s[3];
332 const u32 wc_t = s[4];
333 const u32 wd_t = s[5];
334 const u32 we_t = s[6];
335 const u32 wf_t = s[7];
342 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
343 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
344 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
345 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
346 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
347 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
348 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
349 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
350 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
351 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
352 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
353 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
354 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
355 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
356 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
357 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
359 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
360 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
361 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
362 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
363 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
364 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
365 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
366 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
367 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
368 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
369 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
370 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
371 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
372 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
373 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
374 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
376 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
377 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
378 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
379 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
380 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
381 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
382 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
383 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
384 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
385 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
386 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
387 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
388 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
389 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
390 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
391 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
393 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
394 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
395 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
396 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
397 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
398 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
399 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
400 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
401 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
402 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
403 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
404 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
405 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
406 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
407 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
408 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
415 #include VECT_COMPARE_M
419 __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)
423 __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)
427 __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)
433 const u32 lid = get_local_id (0);
439 const u32 gid = get_global_id (0);
443 wordl0[0] = pws[gid].i[ 0];
444 wordl0[1] = pws[gid].i[ 1];
445 wordl0[2] = pws[gid].i[ 2];
446 wordl0[3] = pws[gid].i[ 3];
450 wordl1[0] = pws[gid].i[ 4];
451 wordl1[1] = pws[gid].i[ 5];
452 wordl1[2] = pws[gid].i[ 6];
453 wordl1[3] = pws[gid].i[ 7];
469 const u32 pw_l_len = pws[gid].pw_len;
471 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
473 append_0x80_2 (wordl0, wordl1, pw_l_len);
475 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
482 const u32 search[4] =
484 digests_buf[digests_offset].digest_buf[DGST_R0],
485 digests_buf[digests_offset].digest_buf[DGST_R1],
486 digests_buf[digests_offset].digest_buf[DGST_R2],
487 digests_buf[digests_offset].digest_buf[DGST_R3]
494 const u32 salt_len = salt_bufs[salt_pos].salt_len;
498 s[0] = salt_bufs[salt_pos].salt_buf[0];
499 s[1] = salt_bufs[salt_pos].salt_buf[1];
500 s[2] = salt_bufs[salt_pos].salt_buf[2];
501 s[3] = salt_bufs[salt_pos].salt_buf[3];
502 s[4] = salt_bufs[salt_pos].salt_buf[4];
503 s[5] = salt_bufs[salt_pos].salt_buf[5];
504 s[6] = (32 + salt_len) * 8;
511 __local u32 l_bin2asc[256];
513 const u32 lid4 = lid * 4;
515 const u32 lid40 = lid4 + 0;
516 const u32 lid41 = lid4 + 1;
517 const u32 lid42 = lid4 + 2;
518 const u32 lid43 = lid4 + 3;
520 const u32 v400 = (lid40 >> 0) & 15;
521 const u32 v401 = (lid40 >> 4) & 15;
522 const u32 v410 = (lid41 >> 0) & 15;
523 const u32 v411 = (lid41 >> 4) & 15;
524 const u32 v420 = (lid42 >> 0) & 15;
525 const u32 v421 = (lid42 >> 4) & 15;
526 const u32 v430 = (lid43 >> 0) & 15;
527 const u32 v431 = (lid43 >> 4) & 15;
529 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
530 | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
531 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
532 | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
533 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
534 | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
535 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
536 | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
538 barrier (CLK_LOCAL_MEM_FENCE);
540 if (gid >= gid_max) return;
546 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
548 const u32 pw_r_len = combs_buf[il_pos].pw_len;
550 const u32 pw_len = pw_l_len + pw_r_len;
554 wordr0[0] = combs_buf[il_pos].i[0];
555 wordr0[1] = combs_buf[il_pos].i[1];
556 wordr0[2] = combs_buf[il_pos].i[2];
557 wordr0[3] = combs_buf[il_pos].i[3];
561 wordr1[0] = combs_buf[il_pos].i[4];
562 wordr1[1] = combs_buf[il_pos].i[5];
563 wordr1[2] = combs_buf[il_pos].i[6];
564 wordr1[3] = combs_buf[il_pos].i[7];
580 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
582 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
587 w0[0] = wordl0[0] | wordr0[0];
588 w0[1] = wordl0[1] | wordr0[1];
589 w0[2] = wordl0[2] | wordr0[2];
590 w0[3] = wordl0[3] | wordr0[3];
594 w1[0] = wordl1[0] | wordr1[0];
595 w1[1] = wordl1[1] | wordr1[1];
596 w1[2] = wordl1[2] | wordr1[2];
597 w1[3] = wordl1[3] | wordr1[3];
601 w2[0] = wordl2[0] | wordr2[0];
602 w2[1] = wordl2[1] | wordr2[1];
603 w2[2] = wordl2[2] | wordr2[2];
604 w2[3] = wordl2[3] | wordr2[3];
608 w3[0] = wordl3[0] | wordr3[0];
609 w3[1] = wordl3[1] | wordr3[1];
618 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
619 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
620 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
621 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
622 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
623 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
624 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
625 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
626 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
627 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
628 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
629 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
630 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
631 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
632 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
633 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
635 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
636 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
637 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
638 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
639 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
640 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
641 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
642 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
643 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
644 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
645 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
646 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
647 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
648 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
649 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
650 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
652 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
653 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
654 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
655 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
656 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
657 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
658 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
659 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
660 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
661 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
662 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
663 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
664 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
665 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
666 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
667 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
669 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
670 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
671 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
672 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
673 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
674 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
675 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
676 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
677 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
678 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
679 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
680 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
681 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
682 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
683 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
684 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
691 const u32x w0_t = uint_to_hex_lower8 ((a >> 0) & 255) << 0
692 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
693 const u32x w1_t = uint_to_hex_lower8 ((a >> 16) & 255) << 0
694 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
695 const u32x w2_t = uint_to_hex_lower8 ((b >> 0) & 255) << 0
696 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
697 const u32x w3_t = uint_to_hex_lower8 ((b >> 16) & 255) << 0
698 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
699 const u32x w4_t = uint_to_hex_lower8 ((c >> 0) & 255) << 0
700 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
701 const u32x w5_t = uint_to_hex_lower8 ((c >> 16) & 255) << 0
702 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
703 const u32x w6_t = uint_to_hex_lower8 ((d >> 0) & 255) << 0
704 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
705 const u32x w7_t = uint_to_hex_lower8 ((d >> 16) & 255) << 0
706 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
708 const u32 w8_t = s[0];
709 const u32 w9_t = s[1];
710 const u32 wa_t = s[2];
711 const u32 wb_t = s[3];
712 const u32 wc_t = s[4];
713 const u32 wd_t = s[5];
714 const u32 we_t = s[6];
715 const u32 wf_t = s[7];
722 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
723 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
724 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
725 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
726 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
727 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
728 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
729 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
730 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
731 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
732 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
733 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
734 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
735 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
736 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
737 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
739 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
740 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
741 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
742 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
743 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
744 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
745 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
746 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
747 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
748 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
749 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
750 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
751 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
752 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
753 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
754 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
756 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
757 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
758 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
759 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
760 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
761 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
762 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
763 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
764 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
765 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
766 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
767 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
768 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
769 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
770 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
771 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
773 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
774 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
775 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
776 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
777 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
778 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
779 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
780 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
781 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
782 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
783 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
784 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
785 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
786 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
787 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
788 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
795 #include VECT_COMPARE_S
799 __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)
803 __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)