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"
31 #include "include/rp_gpu.h"
35 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
36 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
40 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
41 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
45 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
46 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
50 #define uint_to_hex_lower8(i) l_bin2asc[(i)]
54 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1])
58 #define uint_to_hex_lower8(i) (u32x) (l_bin2asc[(i).s0], l_bin2asc[(i).s1], l_bin2asc[(i).s2], l_bin2asc[(i).s3])
61 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04310_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)
67 const u32 lid = get_local_id (0);
73 const u32 gid = get_global_id (0);
77 pw_buf0[0] = pws[gid].i[ 0];
78 pw_buf0[1] = pws[gid].i[ 1];
79 pw_buf0[2] = pws[gid].i[ 2];
80 pw_buf0[3] = pws[gid].i[ 3];
84 pw_buf1[0] = pws[gid].i[ 4];
85 pw_buf1[1] = pws[gid].i[ 5];
86 pw_buf1[2] = pws[gid].i[ 6];
87 pw_buf1[3] = pws[gid].i[ 7];
89 const u32 pw_len = pws[gid].pw_len;
95 const u32 salt_len = salt_bufs[salt_pos].salt_len;
99 s[0] = salt_bufs[salt_pos].salt_buf[0];
100 s[1] = salt_bufs[salt_pos].salt_buf[1];
101 s[2] = salt_bufs[salt_pos].salt_buf[2];
102 s[3] = salt_bufs[salt_pos].salt_buf[3];
103 s[4] = salt_bufs[salt_pos].salt_buf[4];
104 s[5] = salt_bufs[salt_pos].salt_buf[5];
105 s[6] = (32 + salt_len) * 8;
112 __local u32 l_bin2asc[256];
114 const u32 lid4 = lid * 4;
116 const u32 lid40 = lid4 + 0;
117 const u32 lid41 = lid4 + 1;
118 const u32 lid42 = lid4 + 2;
119 const u32 lid43 = lid4 + 3;
121 const u32 v400 = (lid40 >> 0) & 15;
122 const u32 v401 = (lid40 >> 4) & 15;
123 const u32 v410 = (lid41 >> 0) & 15;
124 const u32 v411 = (lid41 >> 4) & 15;
125 const u32 v420 = (lid42 >> 0) & 15;
126 const u32 v421 = (lid42 >> 4) & 15;
127 const u32 v430 = (lid43 >> 0) & 15;
128 const u32 v431 = (lid43 >> 4) & 15;
130 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'A' - 10 + v400) << 8
131 | ((v401 < 10) ? '0' + v401 : 'A' - 10 + v401) << 0;
132 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'A' - 10 + v410) << 8
133 | ((v411 < 10) ? '0' + v411 : 'A' - 10 + v411) << 0;
134 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'A' - 10 + v420) << 8
135 | ((v421 < 10) ? '0' + v421 : 'A' - 10 + v421) << 0;
136 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'A' - 10 + v430) << 8
137 | ((v431 < 10) ? '0' + v431 : 'A' - 10 + v431) << 0;
139 barrier (CLK_LOCAL_MEM_FENCE);
141 if (gid >= gid_max) return;
147 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
177 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
179 append_0x80_2 (w0, w1, out_len);
188 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
189 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
190 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
191 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
192 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
193 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
194 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
195 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
196 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
197 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
198 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
199 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
200 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
201 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
202 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
203 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
205 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
206 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
207 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
208 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
209 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
210 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
211 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
212 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
213 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
214 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
215 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
216 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
217 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
218 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
219 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
220 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
222 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
223 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
224 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
225 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
226 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
227 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
228 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
229 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
230 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
231 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
232 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
233 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
234 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
235 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
236 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
237 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
239 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
240 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
241 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
242 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
243 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
244 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
245 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
246 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
247 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
248 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
249 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
250 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
251 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
252 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
253 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
254 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
261 const u32x w0_t = uint_to_hex_lower8 ((a >> 0) & 255) << 0
262 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
263 const u32x w1_t = uint_to_hex_lower8 ((a >> 16) & 255) << 0
264 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
265 const u32x w2_t = uint_to_hex_lower8 ((b >> 0) & 255) << 0
266 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
267 const u32x w3_t = uint_to_hex_lower8 ((b >> 16) & 255) << 0
268 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
269 const u32x w4_t = uint_to_hex_lower8 ((c >> 0) & 255) << 0
270 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
271 const u32x w5_t = uint_to_hex_lower8 ((c >> 16) & 255) << 0
272 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
273 const u32x w6_t = uint_to_hex_lower8 ((d >> 0) & 255) << 0
274 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
275 const u32x w7_t = uint_to_hex_lower8 ((d >> 16) & 255) << 0
276 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
278 const u32 w8_t = s[0];
279 const u32 w9_t = s[1];
280 const u32 wa_t = s[2];
281 const u32 wb_t = s[3];
282 const u32 wc_t = s[4];
283 const u32 wd_t = s[5];
284 const u32 we_t = s[6];
285 const u32 wf_t = s[7];
292 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
293 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
294 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
295 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
296 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
297 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
298 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
299 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
300 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
301 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
302 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
303 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
304 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
305 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
306 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
307 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
309 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
310 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
311 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
312 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
313 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
314 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
315 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
316 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
317 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
318 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
319 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
320 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
321 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
322 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
323 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
324 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
326 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
327 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
328 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
329 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
330 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
331 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
332 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
333 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
334 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
335 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
336 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
337 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
338 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
339 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
340 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
341 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
343 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
344 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
345 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
346 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
347 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
348 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
349 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
350 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
351 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
352 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
353 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
354 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
355 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
356 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
357 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
358 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
365 #include VECT_COMPARE_M
369 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04310_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)
373 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04310_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)
377 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04310_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)
383 const u32 lid = get_local_id (0);
389 const u32 gid = get_global_id (0);
393 pw_buf0[0] = pws[gid].i[ 0];
394 pw_buf0[1] = pws[gid].i[ 1];
395 pw_buf0[2] = pws[gid].i[ 2];
396 pw_buf0[3] = pws[gid].i[ 3];
400 pw_buf1[0] = pws[gid].i[ 4];
401 pw_buf1[1] = pws[gid].i[ 5];
402 pw_buf1[2] = pws[gid].i[ 6];
403 pw_buf1[3] = pws[gid].i[ 7];
405 const u32 pw_len = pws[gid].pw_len;
411 const u32 salt_len = salt_bufs[salt_pos].salt_len;
415 s[0] = salt_bufs[salt_pos].salt_buf[0];
416 s[1] = salt_bufs[salt_pos].salt_buf[1];
417 s[2] = salt_bufs[salt_pos].salt_buf[2];
418 s[3] = salt_bufs[salt_pos].salt_buf[3];
419 s[4] = salt_bufs[salt_pos].salt_buf[4];
420 s[5] = salt_bufs[salt_pos].salt_buf[5];
421 s[6] = (32 + salt_len) * 8;
428 const u32 search[4] =
430 digests_buf[digests_offset].digest_buf[DGST_R0],
431 digests_buf[digests_offset].digest_buf[DGST_R1],
432 digests_buf[digests_offset].digest_buf[DGST_R2],
433 digests_buf[digests_offset].digest_buf[DGST_R3]
440 __local u32 l_bin2asc[256];
442 const u32 lid4 = lid * 4;
444 const u32 lid40 = lid4 + 0;
445 const u32 lid41 = lid4 + 1;
446 const u32 lid42 = lid4 + 2;
447 const u32 lid43 = lid4 + 3;
449 const u32 v400 = (lid40 >> 0) & 15;
450 const u32 v401 = (lid40 >> 4) & 15;
451 const u32 v410 = (lid41 >> 0) & 15;
452 const u32 v411 = (lid41 >> 4) & 15;
453 const u32 v420 = (lid42 >> 0) & 15;
454 const u32 v421 = (lid42 >> 4) & 15;
455 const u32 v430 = (lid43 >> 0) & 15;
456 const u32 v431 = (lid43 >> 4) & 15;
458 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'A' - 10 + v400) << 8
459 | ((v401 < 10) ? '0' + v401 : 'A' - 10 + v401) << 0;
460 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'A' - 10 + v410) << 8
461 | ((v411 < 10) ? '0' + v411 : 'A' - 10 + v411) << 0;
462 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'A' - 10 + v420) << 8
463 | ((v421 < 10) ? '0' + v421 : 'A' - 10 + v421) << 0;
464 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'A' - 10 + v430) << 8
465 | ((v431 < 10) ? '0' + v431 : 'A' - 10 + v431) << 0;
467 barrier (CLK_LOCAL_MEM_FENCE);
469 if (gid >= gid_max) return;
475 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
505 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
507 append_0x80_2 (w0, w1, out_len);
516 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
517 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
518 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
519 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
520 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
521 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
522 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
523 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
524 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
525 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
526 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
527 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
528 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
529 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
530 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
531 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
533 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
534 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
535 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
536 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
537 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
538 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
539 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
540 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
541 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
542 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
543 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
544 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
545 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
546 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
547 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
548 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
550 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
551 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
552 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
553 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
554 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
555 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
556 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
557 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
558 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
559 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
560 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
561 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
562 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
563 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
564 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
565 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
567 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
568 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
569 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
570 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
571 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
572 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
573 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
574 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
575 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
576 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
577 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
578 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
579 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
580 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
581 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
582 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
589 const u32x w0_t = uint_to_hex_lower8 ((a >> 0) & 255) << 0
590 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
591 const u32x w1_t = uint_to_hex_lower8 ((a >> 16) & 255) << 0
592 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
593 const u32x w2_t = uint_to_hex_lower8 ((b >> 0) & 255) << 0
594 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
595 const u32x w3_t = uint_to_hex_lower8 ((b >> 16) & 255) << 0
596 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
597 const u32x w4_t = uint_to_hex_lower8 ((c >> 0) & 255) << 0
598 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
599 const u32x w5_t = uint_to_hex_lower8 ((c >> 16) & 255) << 0
600 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
601 const u32x w6_t = uint_to_hex_lower8 ((d >> 0) & 255) << 0
602 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
603 const u32x w7_t = uint_to_hex_lower8 ((d >> 16) & 255) << 0
604 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
606 const u32 w8_t = s[0];
607 const u32 w9_t = s[1];
608 const u32 wa_t = s[2];
609 const u32 wb_t = s[3];
610 const u32 wc_t = s[4];
611 const u32 wd_t = s[5];
612 const u32 we_t = s[6];
613 const u32 wf_t = s[7];
620 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
621 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
622 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
623 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
624 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
625 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
626 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
627 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
628 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
629 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
630 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
631 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
632 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
633 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
634 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
635 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
637 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
638 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
639 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
640 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
641 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
642 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
643 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
644 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
645 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
646 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
647 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
648 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
649 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
650 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
651 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
652 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
654 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
655 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
656 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
657 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
658 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
659 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
660 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
661 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
662 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
663 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
664 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
665 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
666 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
667 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
668 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
669 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
671 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
672 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
673 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
674 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
675 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
676 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
677 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
678 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
679 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
680 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
681 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
682 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
683 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
684 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
685 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
686 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
693 #include VECT_COMPARE_S
697 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04310_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)
701 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04310_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)