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 "OpenCL/types_ocl.c"
18 #include "OpenCL/common.c"
19 #include "include/rp_gpu.h"
20 #include "OpenCL/rp.c"
22 #define COMPARE_S "OpenCL/check_single_comp4.c"
23 #define COMPARE_M "OpenCL/check_multi_comp4.c"
25 #define uint_to_hex_lower8(i) l_bin2asc[(i)]
27 __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)
33 const u32 lid = get_local_id (0);
39 const u32 gid = get_global_id (0);
43 pw_buf0[0] = pws[gid].i[ 0];
44 pw_buf0[1] = pws[gid].i[ 1];
45 pw_buf0[2] = pws[gid].i[ 2];
46 pw_buf0[3] = pws[gid].i[ 3];
50 pw_buf1[0] = pws[gid].i[ 4];
51 pw_buf1[1] = pws[gid].i[ 5];
52 pw_buf1[2] = pws[gid].i[ 6];
53 pw_buf1[3] = pws[gid].i[ 7];
55 const u32 pw_len = pws[gid].pw_len;
61 const u32 salt_len = salt_bufs[salt_pos].salt_len;
65 s[0] = salt_bufs[salt_pos].salt_buf[0];
66 s[1] = salt_bufs[salt_pos].salt_buf[1];
67 s[2] = salt_bufs[salt_pos].salt_buf[2];
68 s[3] = salt_bufs[salt_pos].salt_buf[3];
69 s[4] = salt_bufs[salt_pos].salt_buf[4];
70 s[5] = salt_bufs[salt_pos].salt_buf[5];
71 s[6] = (32 + salt_len) * 8;
78 __local u32 l_bin2asc[256];
80 const u32 lid4 = lid * 4;
82 const u32 lid40 = lid4 + 0;
83 const u32 lid41 = lid4 + 1;
84 const u32 lid42 = lid4 + 2;
85 const u32 lid43 = lid4 + 3;
87 const u32 v400 = (lid40 >> 0) & 15;
88 const u32 v401 = (lid40 >> 4) & 15;
89 const u32 v410 = (lid41 >> 0) & 15;
90 const u32 v411 = (lid41 >> 4) & 15;
91 const u32 v420 = (lid42 >> 0) & 15;
92 const u32 v421 = (lid42 >> 4) & 15;
93 const u32 v430 = (lid43 >> 0) & 15;
94 const u32 v431 = (lid43 >> 4) & 15;
96 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'A' - 10 + v400) << 8
97 | ((v401 < 10) ? '0' + v401 : 'A' - 10 + v401) << 0;
98 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'A' - 10 + v410) << 8
99 | ((v411 < 10) ? '0' + v411 : 'A' - 10 + v411) << 0;
100 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'A' - 10 + v420) << 8
101 | ((v421 < 10) ? '0' + v421 : 'A' - 10 + v421) << 0;
102 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'A' - 10 + v430) << 8
103 | ((v431 < 10) ? '0' + v431 : 'A' - 10 + v431) << 0;
105 barrier (CLK_LOCAL_MEM_FENCE);
107 if (gid >= gid_max) return;
113 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
143 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
145 append_0x80_2x4 (w0, w1, out_len);
154 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
155 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
156 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
157 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
158 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
159 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
160 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
161 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
162 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
163 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
164 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
165 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
166 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
167 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
168 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
169 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
171 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
172 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
173 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
174 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
175 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
176 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
177 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
178 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
179 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
180 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
181 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
182 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
183 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
184 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
185 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
186 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
188 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
189 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
190 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
191 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
192 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
193 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
194 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
195 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
196 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
197 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
198 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
199 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
200 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
201 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
202 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
203 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
205 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
206 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
207 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
208 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
209 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
210 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
211 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
212 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
213 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
214 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
215 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
216 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
217 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
218 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
219 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
220 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
227 const u32 w0_t = uint_to_hex_lower8 ((a >> 0) & 255) << 0
228 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
229 const u32 w1_t = uint_to_hex_lower8 ((a >> 16) & 255) << 0
230 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
231 const u32 w2_t = uint_to_hex_lower8 ((b >> 0) & 255) << 0
232 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
233 const u32 w3_t = uint_to_hex_lower8 ((b >> 16) & 255) << 0
234 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
235 const u32 w4_t = uint_to_hex_lower8 ((c >> 0) & 255) << 0
236 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
237 const u32 w5_t = uint_to_hex_lower8 ((c >> 16) & 255) << 0
238 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
239 const u32 w6_t = uint_to_hex_lower8 ((d >> 0) & 255) << 0
240 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
241 const u32 w7_t = uint_to_hex_lower8 ((d >> 16) & 255) << 0
242 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
244 const u32 w8_t = s[0];
245 const u32 w9_t = s[1];
246 const u32 wa_t = s[2];
247 const u32 wb_t = s[3];
248 const u32 wc_t = s[4];
249 const u32 wd_t = s[5];
250 const u32 we_t = s[6];
251 const u32 wf_t = s[7];
258 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
259 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
260 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
261 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
262 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
263 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
264 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
265 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
266 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
267 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
268 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
269 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
270 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
271 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
272 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
273 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
275 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
276 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
277 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
278 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
279 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
280 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
281 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
282 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
283 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
284 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
285 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
286 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
287 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
288 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
289 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
290 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
292 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
293 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
294 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
295 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
296 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
297 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
298 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
299 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
300 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
301 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
302 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
303 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
304 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
305 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
306 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
307 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
309 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
310 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
311 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
312 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
313 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
314 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
315 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
316 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
317 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
318 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
319 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
320 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
321 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
322 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
323 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
324 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
335 __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)
339 __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)
343 __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)
349 const u32 lid = get_local_id (0);
355 const u32 gid = get_global_id (0);
359 pw_buf0[0] = pws[gid].i[ 0];
360 pw_buf0[1] = pws[gid].i[ 1];
361 pw_buf0[2] = pws[gid].i[ 2];
362 pw_buf0[3] = pws[gid].i[ 3];
366 pw_buf1[0] = pws[gid].i[ 4];
367 pw_buf1[1] = pws[gid].i[ 5];
368 pw_buf1[2] = pws[gid].i[ 6];
369 pw_buf1[3] = pws[gid].i[ 7];
371 const u32 pw_len = pws[gid].pw_len;
377 const u32 salt_len = salt_bufs[salt_pos].salt_len;
381 s[0] = salt_bufs[salt_pos].salt_buf[0];
382 s[1] = salt_bufs[salt_pos].salt_buf[1];
383 s[2] = salt_bufs[salt_pos].salt_buf[2];
384 s[3] = salt_bufs[salt_pos].salt_buf[3];
385 s[4] = salt_bufs[salt_pos].salt_buf[4];
386 s[5] = salt_bufs[salt_pos].salt_buf[5];
387 s[6] = (32 + salt_len) * 8;
394 const u32 search[4] =
396 digests_buf[digests_offset].digest_buf[DGST_R0],
397 digests_buf[digests_offset].digest_buf[DGST_R1],
398 digests_buf[digests_offset].digest_buf[DGST_R2],
399 digests_buf[digests_offset].digest_buf[DGST_R3]
406 __local u32 l_bin2asc[256];
408 const u32 lid4 = lid * 4;
410 const u32 lid40 = lid4 + 0;
411 const u32 lid41 = lid4 + 1;
412 const u32 lid42 = lid4 + 2;
413 const u32 lid43 = lid4 + 3;
415 const u32 v400 = (lid40 >> 0) & 15;
416 const u32 v401 = (lid40 >> 4) & 15;
417 const u32 v410 = (lid41 >> 0) & 15;
418 const u32 v411 = (lid41 >> 4) & 15;
419 const u32 v420 = (lid42 >> 0) & 15;
420 const u32 v421 = (lid42 >> 4) & 15;
421 const u32 v430 = (lid43 >> 0) & 15;
422 const u32 v431 = (lid43 >> 4) & 15;
424 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'A' - 10 + v400) << 8
425 | ((v401 < 10) ? '0' + v401 : 'A' - 10 + v401) << 0;
426 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'A' - 10 + v410) << 8
427 | ((v411 < 10) ? '0' + v411 : 'A' - 10 + v411) << 0;
428 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'A' - 10 + v420) << 8
429 | ((v421 < 10) ? '0' + v421 : 'A' - 10 + v421) << 0;
430 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'A' - 10 + v430) << 8
431 | ((v431 < 10) ? '0' + v431 : 'A' - 10 + v431) << 0;
433 barrier (CLK_LOCAL_MEM_FENCE);
435 if (gid >= gid_max) return;
441 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
471 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
473 append_0x80_2x4 (w0, w1, out_len);
482 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
483 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
484 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
485 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
486 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
487 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
488 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
489 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
490 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
491 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
492 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
493 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
494 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
495 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
496 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
497 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
499 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
500 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
501 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
502 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
503 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
504 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
505 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
506 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
507 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
508 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
509 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
510 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
511 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
512 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
513 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
514 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
516 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
517 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
518 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
519 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
520 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
521 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
522 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
523 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
524 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
525 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
526 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
527 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
528 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
529 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
530 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
531 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
533 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
534 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
535 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
536 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
537 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
538 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
539 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
540 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
541 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
542 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
543 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
544 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
545 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
546 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
547 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
548 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
555 const u32 w0_t = uint_to_hex_lower8 ((a >> 0) & 255) << 0
556 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
557 const u32 w1_t = uint_to_hex_lower8 ((a >> 16) & 255) << 0
558 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
559 const u32 w2_t = uint_to_hex_lower8 ((b >> 0) & 255) << 0
560 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
561 const u32 w3_t = uint_to_hex_lower8 ((b >> 16) & 255) << 0
562 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
563 const u32 w4_t = uint_to_hex_lower8 ((c >> 0) & 255) << 0
564 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
565 const u32 w5_t = uint_to_hex_lower8 ((c >> 16) & 255) << 0
566 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
567 const u32 w6_t = uint_to_hex_lower8 ((d >> 0) & 255) << 0
568 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
569 const u32 w7_t = uint_to_hex_lower8 ((d >> 16) & 255) << 0
570 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
572 const u32 w8_t = s[0];
573 const u32 w9_t = s[1];
574 const u32 wa_t = s[2];
575 const u32 wb_t = s[3];
576 const u32 wc_t = s[4];
577 const u32 wd_t = s[5];
578 const u32 we_t = s[6];
579 const u32 wf_t = s[7];
586 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
587 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
588 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
589 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
590 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
591 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
592 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
593 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
594 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
595 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
596 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
597 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
598 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
599 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
600 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
601 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
603 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
604 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
605 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
606 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
607 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
608 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
609 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
610 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
611 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
612 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
613 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
614 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
615 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
616 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
617 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
618 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
620 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
621 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
622 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
623 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
624 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
625 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
626 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
627 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
628 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
629 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
630 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
631 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
632 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
633 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
634 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
635 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
637 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
638 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
639 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
640 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
641 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
642 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
643 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
644 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
645 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
646 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
647 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
648 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
649 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
650 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
651 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
652 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
663 __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)
667 __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)