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"
19 #include "include/rp_gpu.h"
22 #define COMPARE_S "check_single_comp4.c"
23 #define COMPARE_M "check_multi_comp4.c"
26 #define uint_to_hex_lower8(i) l_bin2asc[(i)]
30 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1])
34 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3])
37 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m03710_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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
43 const u32 lid = get_local_id (0);
49 const u32 gid = get_global_id (0);
53 pw_buf0[0] = pws[gid].i[ 0];
54 pw_buf0[1] = pws[gid].i[ 1];
55 pw_buf0[2] = pws[gid].i[ 2];
56 pw_buf0[3] = pws[gid].i[ 3];
60 pw_buf1[0] = pws[gid].i[ 4];
61 pw_buf1[1] = pws[gid].i[ 5];
62 pw_buf1[2] = pws[gid].i[ 6];
63 pw_buf1[3] = pws[gid].i[ 7];
65 const u32 pw_len = pws[gid].pw_len;
73 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
74 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
75 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
76 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
80 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
81 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
82 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
83 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
99 const u32 salt_len = salt_bufs[salt_pos].salt_len;
101 const u32 pw_salt_len = 32 + salt_len;
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 < rules_cnt; il_pos++)
172 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
174 append_0x80_2 (w0, w1, out_len);
183 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
184 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
185 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
186 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
187 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
188 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
189 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
190 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
191 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
192 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
193 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
194 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
195 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
196 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
197 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
198 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
200 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
201 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
202 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
203 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
204 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
205 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
206 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
207 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
208 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
209 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
210 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
211 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
212 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
213 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
214 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
215 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
217 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
218 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
219 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
220 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
221 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
222 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
223 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
224 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
225 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
226 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
227 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
228 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
229 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
230 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
231 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
232 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
234 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
235 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
236 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
237 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
238 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
239 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
240 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
241 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
242 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
243 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
244 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
245 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
246 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
247 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
248 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
249 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
261 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
262 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
263 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
264 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
265 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
266 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
267 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
268 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
269 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
270 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
271 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
272 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
273 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
274 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
275 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
276 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
278 w2_t[0] = 0x00000080;
292 switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, salt_len);
294 w3_t[2] = pw_salt_len * 8;
296 w0_t[0] |= salt_buf0[0];
297 w0_t[1] |= salt_buf0[1];
298 w0_t[2] |= salt_buf0[2];
299 w0_t[3] |= salt_buf0[3];
300 w1_t[0] |= salt_buf1[0];
301 w1_t[1] |= salt_buf1[1];
302 w1_t[2] |= salt_buf1[2];
303 w1_t[3] |= salt_buf1[3];
304 w2_t[0] |= salt_buf2[0];
305 w2_t[1] |= salt_buf2[1];
306 w2_t[2] |= salt_buf2[2];
307 w2_t[3] |= salt_buf2[3];
308 w3_t[0] |= salt_buf3[0];
309 w3_t[1] |= salt_buf3[1];
310 w3_t[2] |= salt_buf3[2];
311 w3_t[3] |= salt_buf3[3];
322 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
323 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
324 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
325 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
326 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
327 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
328 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
329 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
330 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
331 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
332 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
333 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
334 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
335 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
336 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
337 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
339 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
340 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
341 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
342 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
343 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
344 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
345 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
346 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
347 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
348 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
349 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
350 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
351 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
352 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
353 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
354 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
356 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
357 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
358 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
359 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
360 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
361 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
362 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
363 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
364 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
365 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
366 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
367 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
368 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
369 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
370 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
371 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
373 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
374 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
375 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
376 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
377 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
378 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
379 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
380 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
381 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
382 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
383 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
384 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
385 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
386 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
387 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
388 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
399 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m03710_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)
403 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m03710_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)
407 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m03710_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 rules_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
413 const u32 lid = get_local_id (0);
419 const u32 gid = get_global_id (0);
423 pw_buf0[0] = pws[gid].i[ 0];
424 pw_buf0[1] = pws[gid].i[ 1];
425 pw_buf0[2] = pws[gid].i[ 2];
426 pw_buf0[3] = pws[gid].i[ 3];
430 pw_buf1[0] = pws[gid].i[ 4];
431 pw_buf1[1] = pws[gid].i[ 5];
432 pw_buf1[2] = pws[gid].i[ 6];
433 pw_buf1[3] = pws[gid].i[ 7];
435 const u32 pw_len = pws[gid].pw_len;
443 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
444 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
445 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
446 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
450 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
451 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
452 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
453 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
469 const u32 salt_len = salt_bufs[salt_pos].salt_len;
471 const u32 pw_salt_len = 32 + salt_len;
477 const u32 search[4] =
479 digests_buf[digests_offset].digest_buf[DGST_R0],
480 digests_buf[digests_offset].digest_buf[DGST_R1],
481 digests_buf[digests_offset].digest_buf[DGST_R2],
482 digests_buf[digests_offset].digest_buf[DGST_R3]
489 __local u32 l_bin2asc[256];
491 const u32 lid4 = lid * 4;
493 const u32 lid40 = lid4 + 0;
494 const u32 lid41 = lid4 + 1;
495 const u32 lid42 = lid4 + 2;
496 const u32 lid43 = lid4 + 3;
498 const u32 v400 = (lid40 >> 0) & 15;
499 const u32 v401 = (lid40 >> 4) & 15;
500 const u32 v410 = (lid41 >> 0) & 15;
501 const u32 v411 = (lid41 >> 4) & 15;
502 const u32 v420 = (lid42 >> 0) & 15;
503 const u32 v421 = (lid42 >> 4) & 15;
504 const u32 v430 = (lid43 >> 0) & 15;
505 const u32 v431 = (lid43 >> 4) & 15;
507 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
508 | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
509 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
510 | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
511 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
512 | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
513 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
514 | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
516 barrier (CLK_LOCAL_MEM_FENCE);
518 if (gid >= gid_max) return;
524 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
554 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
556 append_0x80_2 (w0, w1, out_len);
565 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
566 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
567 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
568 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
569 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
570 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
571 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
572 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
573 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
574 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
575 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
576 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
577 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
578 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
579 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
580 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
582 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
583 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
584 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
585 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
586 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
587 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
588 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
589 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
590 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
591 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
592 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
593 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
594 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
595 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
596 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
597 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
599 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
600 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
601 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
602 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
603 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
604 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
605 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
606 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
607 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
608 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
609 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
610 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
611 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
612 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
613 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
614 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
616 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
617 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
618 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
619 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
620 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
621 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
622 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
623 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
624 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
625 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
626 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
627 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
628 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
629 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
630 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
631 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
643 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
644 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
645 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
646 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
647 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
648 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
649 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
650 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
651 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
652 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
653 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
654 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
655 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
656 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
657 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
658 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
660 w2_t[0] = 0x00000080;
674 switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, salt_len);
676 w3_t[2] = pw_salt_len * 8;
678 w0_t[0] |= salt_buf0[0];
679 w0_t[1] |= salt_buf0[1];
680 w0_t[2] |= salt_buf0[2];
681 w0_t[3] |= salt_buf0[3];
682 w1_t[0] |= salt_buf1[0];
683 w1_t[1] |= salt_buf1[1];
684 w1_t[2] |= salt_buf1[2];
685 w1_t[3] |= salt_buf1[3];
686 w2_t[0] |= salt_buf2[0];
687 w2_t[1] |= salt_buf2[1];
688 w2_t[2] |= salt_buf2[2];
689 w2_t[3] |= salt_buf2[3];
690 w3_t[0] |= salt_buf3[0];
691 w3_t[1] |= salt_buf3[1];
692 w3_t[2] |= salt_buf3[2];
693 w3_t[3] |= salt_buf3[3];
704 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
705 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
706 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
707 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
708 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
709 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
710 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
711 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
712 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
713 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
714 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
715 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
716 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
717 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
718 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
719 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
721 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
722 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
723 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
724 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
725 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
726 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
727 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
728 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
729 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
730 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
731 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
732 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
733 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
734 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
735 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
736 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
738 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
739 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
740 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
741 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
742 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
743 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
744 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
745 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
746 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
747 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
748 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
749 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
750 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
751 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
752 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
753 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
755 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
756 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
757 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
758 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
759 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
760 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
761 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
762 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
763 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
764 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
765 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
766 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
767 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
768 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
769 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
770 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
781 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m03710_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)
785 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m03710_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)