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"
23 #define uint_to_hex_lower8(i) l_bin2asc[(i)]
25 __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)
31 const u32 lid = get_local_id (0);
37 const u32 gid = get_global_id (0);
41 wordl0[0] = pws[gid].i[ 0];
42 wordl0[1] = pws[gid].i[ 1];
43 wordl0[2] = pws[gid].i[ 2];
44 wordl0[3] = pws[gid].i[ 3];
48 wordl1[0] = pws[gid].i[ 4];
49 wordl1[1] = pws[gid].i[ 5];
50 wordl1[2] = pws[gid].i[ 6];
51 wordl1[3] = pws[gid].i[ 7];
67 const u32 pw_l_len = pws[gid].pw_len;
69 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
71 append_0x80_2x4 (wordl0, wordl1, pw_l_len);
73 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
80 const u32 salt_len = salt_bufs[salt_pos].salt_len;
84 s[0] = salt_bufs[salt_pos].salt_buf[0];
85 s[1] = salt_bufs[salt_pos].salt_buf[1];
86 s[2] = salt_bufs[salt_pos].salt_buf[2];
87 s[3] = salt_bufs[salt_pos].salt_buf[3];
88 s[4] = salt_bufs[salt_pos].salt_buf[4];
89 s[5] = salt_bufs[salt_pos].salt_buf[5];
90 s[6] = (32 + salt_len) * 8;
97 __local u32 l_bin2asc[256];
99 const u32 lid4 = lid * 4;
101 const u32 lid40 = lid4 + 0;
102 const u32 lid41 = lid4 + 1;
103 const u32 lid42 = lid4 + 2;
104 const u32 lid43 = lid4 + 3;
106 const u32 v400 = (lid40 >> 0) & 15;
107 const u32 v401 = (lid40 >> 4) & 15;
108 const u32 v410 = (lid41 >> 0) & 15;
109 const u32 v411 = (lid41 >> 4) & 15;
110 const u32 v420 = (lid42 >> 0) & 15;
111 const u32 v421 = (lid42 >> 4) & 15;
112 const u32 v430 = (lid43 >> 0) & 15;
113 const u32 v431 = (lid43 >> 4) & 15;
115 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
116 | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
117 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
118 | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
119 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
120 | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
121 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
122 | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
124 barrier (CLK_LOCAL_MEM_FENCE);
126 if (gid >= gid_max) return;
132 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
134 const u32 pw_r_len = combs_buf[il_pos].pw_len;
136 const u32 pw_len = pw_l_len + pw_r_len;
140 wordr0[0] = combs_buf[il_pos].i[0];
141 wordr0[1] = combs_buf[il_pos].i[1];
142 wordr0[2] = combs_buf[il_pos].i[2];
143 wordr0[3] = combs_buf[il_pos].i[3];
147 wordr1[0] = combs_buf[il_pos].i[4];
148 wordr1[1] = combs_buf[il_pos].i[5];
149 wordr1[2] = combs_buf[il_pos].i[6];
150 wordr1[3] = combs_buf[il_pos].i[7];
166 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
168 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
173 w0[0] = wordl0[0] | wordr0[0];
174 w0[1] = wordl0[1] | wordr0[1];
175 w0[2] = wordl0[2] | wordr0[2];
176 w0[3] = wordl0[3] | wordr0[3];
180 w1[0] = wordl1[0] | wordr1[0];
181 w1[1] = wordl1[1] | wordr1[1];
182 w1[2] = wordl1[2] | wordr1[2];
183 w1[3] = wordl1[3] | wordr1[3];
187 w2[0] = wordl2[0] | wordr2[0];
188 w2[1] = wordl2[1] | wordr2[1];
189 w2[2] = wordl2[2] | wordr2[2];
190 w2[3] = wordl2[3] | wordr2[3];
194 w3[0] = wordl3[0] | wordr3[0];
195 w3[1] = wordl3[1] | wordr3[1];
204 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
205 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
206 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
207 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
208 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
209 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
210 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
211 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
212 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
213 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
214 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
215 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
216 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
217 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
218 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
219 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
221 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
222 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
223 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
224 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
225 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
226 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
227 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
228 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
229 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
230 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
231 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
232 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
233 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
234 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
235 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
236 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
238 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
239 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
240 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
241 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
242 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
243 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
244 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
245 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
246 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
247 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
248 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
249 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
250 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
251 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
252 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
253 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
255 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
256 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
257 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
258 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
259 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
260 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
261 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
262 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
263 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
264 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
265 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
266 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
267 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
268 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
269 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
270 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
277 const u32 w0_t = uint_to_hex_lower8 ((a >> 0) & 255) << 0
278 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
279 const u32 w1_t = uint_to_hex_lower8 ((a >> 16) & 255) << 0
280 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
281 const u32 w2_t = uint_to_hex_lower8 ((b >> 0) & 255) << 0
282 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
283 const u32 w3_t = uint_to_hex_lower8 ((b >> 16) & 255) << 0
284 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
285 const u32 w4_t = uint_to_hex_lower8 ((c >> 0) & 255) << 0
286 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
287 const u32 w5_t = uint_to_hex_lower8 ((c >> 16) & 255) << 0
288 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
289 const u32 w6_t = uint_to_hex_lower8 ((d >> 0) & 255) << 0
290 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
291 const u32 w7_t = uint_to_hex_lower8 ((d >> 16) & 255) << 0
292 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
294 const u32 w8_t = s[0];
295 const u32 w9_t = s[1];
296 const u32 wa_t = s[2];
297 const u32 wb_t = s[3];
298 const u32 wc_t = s[4];
299 const u32 wd_t = s[5];
300 const u32 we_t = s[6];
301 const u32 wf_t = s[7];
308 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
309 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
310 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
311 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
312 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
313 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
314 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
315 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
316 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
317 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
318 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
319 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
320 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
321 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
322 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
323 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
325 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
326 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
327 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
328 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
329 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
330 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
331 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
332 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
333 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
334 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
335 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
336 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
337 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
338 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
339 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
340 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
342 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
343 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
344 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
345 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
346 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
347 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
348 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
349 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
350 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
351 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
352 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
353 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
354 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
355 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
356 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
357 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
359 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
360 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
361 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
362 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
363 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
364 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
365 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
366 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
367 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
368 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
369 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
370 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
371 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
372 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
373 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
374 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
385 __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)
389 __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)
393 __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)
399 const u32 lid = get_local_id (0);
405 const u32 gid = get_global_id (0);
409 wordl0[0] = pws[gid].i[ 0];
410 wordl0[1] = pws[gid].i[ 1];
411 wordl0[2] = pws[gid].i[ 2];
412 wordl0[3] = pws[gid].i[ 3];
416 wordl1[0] = pws[gid].i[ 4];
417 wordl1[1] = pws[gid].i[ 5];
418 wordl1[2] = pws[gid].i[ 6];
419 wordl1[3] = pws[gid].i[ 7];
435 const u32 pw_l_len = pws[gid].pw_len;
437 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
439 append_0x80_2x4 (wordl0, wordl1, pw_l_len);
441 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
448 const u32 search[4] =
450 digests_buf[digests_offset].digest_buf[DGST_R0],
451 digests_buf[digests_offset].digest_buf[DGST_R1],
452 digests_buf[digests_offset].digest_buf[DGST_R2],
453 digests_buf[digests_offset].digest_buf[DGST_R3]
460 const u32 salt_len = salt_bufs[salt_pos].salt_len;
464 s[0] = salt_bufs[salt_pos].salt_buf[0];
465 s[1] = salt_bufs[salt_pos].salt_buf[1];
466 s[2] = salt_bufs[salt_pos].salt_buf[2];
467 s[3] = salt_bufs[salt_pos].salt_buf[3];
468 s[4] = salt_bufs[salt_pos].salt_buf[4];
469 s[5] = salt_bufs[salt_pos].salt_buf[5];
470 s[6] = (32 + salt_len) * 8;
477 __local u32 l_bin2asc[256];
479 const u32 lid4 = lid * 4;
481 const u32 lid40 = lid4 + 0;
482 const u32 lid41 = lid4 + 1;
483 const u32 lid42 = lid4 + 2;
484 const u32 lid43 = lid4 + 3;
486 const u32 v400 = (lid40 >> 0) & 15;
487 const u32 v401 = (lid40 >> 4) & 15;
488 const u32 v410 = (lid41 >> 0) & 15;
489 const u32 v411 = (lid41 >> 4) & 15;
490 const u32 v420 = (lid42 >> 0) & 15;
491 const u32 v421 = (lid42 >> 4) & 15;
492 const u32 v430 = (lid43 >> 0) & 15;
493 const u32 v431 = (lid43 >> 4) & 15;
495 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
496 | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
497 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
498 | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
499 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
500 | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
501 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
502 | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
504 barrier (CLK_LOCAL_MEM_FENCE);
506 if (gid >= gid_max) return;
512 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
514 const u32 pw_r_len = combs_buf[il_pos].pw_len;
516 const u32 pw_len = pw_l_len + pw_r_len;
520 wordr0[0] = combs_buf[il_pos].i[0];
521 wordr0[1] = combs_buf[il_pos].i[1];
522 wordr0[2] = combs_buf[il_pos].i[2];
523 wordr0[3] = combs_buf[il_pos].i[3];
527 wordr1[0] = combs_buf[il_pos].i[4];
528 wordr1[1] = combs_buf[il_pos].i[5];
529 wordr1[2] = combs_buf[il_pos].i[6];
530 wordr1[3] = combs_buf[il_pos].i[7];
546 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
548 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
553 w0[0] = wordl0[0] | wordr0[0];
554 w0[1] = wordl0[1] | wordr0[1];
555 w0[2] = wordl0[2] | wordr0[2];
556 w0[3] = wordl0[3] | wordr0[3];
560 w1[0] = wordl1[0] | wordr1[0];
561 w1[1] = wordl1[1] | wordr1[1];
562 w1[2] = wordl1[2] | wordr1[2];
563 w1[3] = wordl1[3] | wordr1[3];
567 w2[0] = wordl2[0] | wordr2[0];
568 w2[1] = wordl2[1] | wordr2[1];
569 w2[2] = wordl2[2] | wordr2[2];
570 w2[3] = wordl2[3] | wordr2[3];
574 w3[0] = wordl3[0] | wordr3[0];
575 w3[1] = wordl3[1] | wordr3[1];
584 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
585 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
586 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
587 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
588 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
589 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
590 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
591 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
592 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
593 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
594 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
595 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
596 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
597 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
598 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
599 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
601 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
602 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
603 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
604 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
605 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
606 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
607 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
608 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
609 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
610 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
611 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
612 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
613 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
614 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
615 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
616 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
618 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
619 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
620 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
621 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
622 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
623 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
624 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
625 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
626 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
627 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
628 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
629 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
630 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
631 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
632 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
633 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
635 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
636 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
637 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
638 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
639 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
640 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
641 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
642 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
643 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
644 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
645 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
646 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
647 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
648 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
649 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
650 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
657 const u32 w0_t = uint_to_hex_lower8 ((a >> 0) & 255) << 0
658 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
659 const u32 w1_t = uint_to_hex_lower8 ((a >> 16) & 255) << 0
660 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
661 const u32 w2_t = uint_to_hex_lower8 ((b >> 0) & 255) << 0
662 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
663 const u32 w3_t = uint_to_hex_lower8 ((b >> 16) & 255) << 0
664 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
665 const u32 w4_t = uint_to_hex_lower8 ((c >> 0) & 255) << 0
666 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
667 const u32 w5_t = uint_to_hex_lower8 ((c >> 16) & 255) << 0
668 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
669 const u32 w6_t = uint_to_hex_lower8 ((d >> 0) & 255) << 0
670 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
671 const u32 w7_t = uint_to_hex_lower8 ((d >> 16) & 255) << 0
672 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
674 const u32 w8_t = s[0];
675 const u32 w9_t = s[1];
676 const u32 wa_t = s[2];
677 const u32 wb_t = s[3];
678 const u32 wc_t = s[4];
679 const u32 wd_t = s[5];
680 const u32 we_t = s[6];
681 const u32 wf_t = s[7];
688 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
689 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
690 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
691 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
692 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
693 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
694 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
695 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
696 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
697 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
698 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
699 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
700 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
701 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
702 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
703 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
705 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
706 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
707 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
708 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
709 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
710 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
711 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
712 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
713 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
714 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
715 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
716 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
717 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
718 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
719 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
720 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
722 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
723 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
724 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
725 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
726 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
727 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
728 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
729 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
730 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
731 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
732 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
733 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
734 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
735 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
736 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
737 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
739 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
740 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
741 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
742 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
743 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
744 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
745 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
746 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
747 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
748 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
749 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
750 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
751 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
752 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
753 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
754 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
765 __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)
769 __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)