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))) 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)
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;
71 const u32 salt_len = salt_bufs[salt_pos].salt_len;
75 s[0] = salt_bufs[salt_pos].salt_buf[0];
76 s[1] = salt_bufs[salt_pos].salt_buf[1];
77 s[2] = salt_bufs[salt_pos].salt_buf[2];
78 s[3] = salt_bufs[salt_pos].salt_buf[3];
79 s[4] = salt_bufs[salt_pos].salt_buf[4];
80 s[5] = salt_bufs[salt_pos].salt_buf[5];
81 s[6] = (32 + salt_len) * 8;
88 __local u32 l_bin2asc[256];
90 const u32 lid4 = lid * 4;
92 const u32 lid40 = lid4 + 0;
93 const u32 lid41 = lid4 + 1;
94 const u32 lid42 = lid4 + 2;
95 const u32 lid43 = lid4 + 3;
97 const u32 v400 = (lid40 >> 0) & 15;
98 const u32 v401 = (lid40 >> 4) & 15;
99 const u32 v410 = (lid41 >> 0) & 15;
100 const u32 v411 = (lid41 >> 4) & 15;
101 const u32 v420 = (lid42 >> 0) & 15;
102 const u32 v421 = (lid42 >> 4) & 15;
103 const u32 v430 = (lid43 >> 0) & 15;
104 const u32 v431 = (lid43 >> 4) & 15;
106 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'A' - 10 + v400) << 8
107 | ((v401 < 10) ? '0' + v401 : 'A' - 10 + v401) << 0;
108 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'A' - 10 + v410) << 8
109 | ((v411 < 10) ? '0' + v411 : 'A' - 10 + v411) << 0;
110 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'A' - 10 + v420) << 8
111 | ((v421 < 10) ? '0' + v421 : 'A' - 10 + v421) << 0;
112 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'A' - 10 + v430) << 8
113 | ((v431 < 10) ? '0' + v431 : 'A' - 10 + v431) << 0;
115 barrier (CLK_LOCAL_MEM_FENCE);
117 if (gid >= gid_max) return;
123 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
153 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
155 append_0x80_2 (w0, w1, out_len);
164 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
165 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
166 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
167 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
168 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
169 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
170 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
171 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
172 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
173 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
174 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
175 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
176 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
177 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
178 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
179 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
181 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
182 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
183 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
184 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
185 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
186 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
187 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
188 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
189 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
190 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
191 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
192 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
193 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
194 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
195 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
196 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
198 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
199 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
200 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
201 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
202 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
203 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
204 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
205 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
206 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
207 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
208 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
209 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
210 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
211 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
212 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
213 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
215 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
216 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
217 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
218 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
219 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
220 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
221 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
222 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
223 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
224 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
225 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
226 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
227 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
228 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
229 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
230 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
237 const u32 w0_t = uint_to_hex_lower8 ((a >> 0) & 255) << 0
238 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
239 const u32 w1_t = uint_to_hex_lower8 ((a >> 16) & 255) << 0
240 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
241 const u32 w2_t = uint_to_hex_lower8 ((b >> 0) & 255) << 0
242 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
243 const u32 w3_t = uint_to_hex_lower8 ((b >> 16) & 255) << 0
244 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
245 const u32 w4_t = uint_to_hex_lower8 ((c >> 0) & 255) << 0
246 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
247 const u32 w5_t = uint_to_hex_lower8 ((c >> 16) & 255) << 0
248 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
249 const u32 w6_t = uint_to_hex_lower8 ((d >> 0) & 255) << 0
250 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
251 const u32 w7_t = uint_to_hex_lower8 ((d >> 16) & 255) << 0
252 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
254 const u32 w8_t = s[0];
255 const u32 w9_t = s[1];
256 const u32 wa_t = s[2];
257 const u32 wb_t = s[3];
258 const u32 wc_t = s[4];
259 const u32 wd_t = s[5];
260 const u32 we_t = s[6];
261 const u32 wf_t = s[7];
268 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
269 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
270 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
271 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
272 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
273 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
274 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
275 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
276 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
277 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
278 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
279 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
280 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
281 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
282 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
283 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
285 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
286 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
287 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
288 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
289 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
290 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
291 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
292 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
293 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
294 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
295 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
296 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
297 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
298 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
299 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
300 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
302 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
303 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
304 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
305 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
306 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
307 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
308 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
309 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
310 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
311 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
312 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
313 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
314 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
315 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
316 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
317 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
319 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
320 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
321 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
322 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
323 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
324 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
325 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
326 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
327 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
328 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
329 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
330 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
331 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
332 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
333 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
334 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
345 __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)
349 __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)
353 __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)
359 const u32 lid = get_local_id (0);
365 const u32 gid = get_global_id (0);
369 pw_buf0[0] = pws[gid].i[ 0];
370 pw_buf0[1] = pws[gid].i[ 1];
371 pw_buf0[2] = pws[gid].i[ 2];
372 pw_buf0[3] = pws[gid].i[ 3];
376 pw_buf1[0] = pws[gid].i[ 4];
377 pw_buf1[1] = pws[gid].i[ 5];
378 pw_buf1[2] = pws[gid].i[ 6];
379 pw_buf1[3] = pws[gid].i[ 7];
381 const u32 pw_len = pws[gid].pw_len;
387 const u32 salt_len = salt_bufs[salt_pos].salt_len;
391 s[0] = salt_bufs[salt_pos].salt_buf[0];
392 s[1] = salt_bufs[salt_pos].salt_buf[1];
393 s[2] = salt_bufs[salt_pos].salt_buf[2];
394 s[3] = salt_bufs[salt_pos].salt_buf[3];
395 s[4] = salt_bufs[salt_pos].salt_buf[4];
396 s[5] = salt_bufs[salt_pos].salt_buf[5];
397 s[6] = (32 + salt_len) * 8;
404 const u32 search[4] =
406 digests_buf[digests_offset].digest_buf[DGST_R0],
407 digests_buf[digests_offset].digest_buf[DGST_R1],
408 digests_buf[digests_offset].digest_buf[DGST_R2],
409 digests_buf[digests_offset].digest_buf[DGST_R3]
416 __local u32 l_bin2asc[256];
418 const u32 lid4 = lid * 4;
420 const u32 lid40 = lid4 + 0;
421 const u32 lid41 = lid4 + 1;
422 const u32 lid42 = lid4 + 2;
423 const u32 lid43 = lid4 + 3;
425 const u32 v400 = (lid40 >> 0) & 15;
426 const u32 v401 = (lid40 >> 4) & 15;
427 const u32 v410 = (lid41 >> 0) & 15;
428 const u32 v411 = (lid41 >> 4) & 15;
429 const u32 v420 = (lid42 >> 0) & 15;
430 const u32 v421 = (lid42 >> 4) & 15;
431 const u32 v430 = (lid43 >> 0) & 15;
432 const u32 v431 = (lid43 >> 4) & 15;
434 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'A' - 10 + v400) << 8
435 | ((v401 < 10) ? '0' + v401 : 'A' - 10 + v401) << 0;
436 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'A' - 10 + v410) << 8
437 | ((v411 < 10) ? '0' + v411 : 'A' - 10 + v411) << 0;
438 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'A' - 10 + v420) << 8
439 | ((v421 < 10) ? '0' + v421 : 'A' - 10 + v421) << 0;
440 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'A' - 10 + v430) << 8
441 | ((v431 < 10) ? '0' + v431 : 'A' - 10 + v431) << 0;
443 barrier (CLK_LOCAL_MEM_FENCE);
445 if (gid >= gid_max) return;
451 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
481 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
483 append_0x80_2 (w0, w1, out_len);
492 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
493 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
494 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
495 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
496 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
497 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
498 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
499 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
500 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
501 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
502 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
503 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
504 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
505 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
506 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
507 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
509 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
510 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
511 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
512 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
513 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
514 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
515 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
516 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
517 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
518 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
519 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
520 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
521 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
522 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
523 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
524 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
526 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
527 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
528 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
529 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
530 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
531 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
532 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
533 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
534 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
535 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
536 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
537 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
538 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
539 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
540 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
541 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
543 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
544 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
545 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
546 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
547 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
548 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
549 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
550 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
551 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
552 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
553 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
554 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
555 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
556 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
557 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
558 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
565 const u32 w0_t = uint_to_hex_lower8 ((a >> 0) & 255) << 0
566 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
567 const u32 w1_t = uint_to_hex_lower8 ((a >> 16) & 255) << 0
568 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
569 const u32 w2_t = uint_to_hex_lower8 ((b >> 0) & 255) << 0
570 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
571 const u32 w3_t = uint_to_hex_lower8 ((b >> 16) & 255) << 0
572 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
573 const u32 w4_t = uint_to_hex_lower8 ((c >> 0) & 255) << 0
574 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
575 const u32 w5_t = uint_to_hex_lower8 ((c >> 16) & 255) << 0
576 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
577 const u32 w6_t = uint_to_hex_lower8 ((d >> 0) & 255) << 0
578 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
579 const u32 w7_t = uint_to_hex_lower8 ((d >> 16) & 255) << 0
580 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
582 const u32 w8_t = s[0];
583 const u32 w9_t = s[1];
584 const u32 wa_t = s[2];
585 const u32 wb_t = s[3];
586 const u32 wc_t = s[4];
587 const u32 wd_t = s[5];
588 const u32 we_t = s[6];
589 const u32 wf_t = s[7];
596 MD5_STEP (MD5_Fo, a, b, c, d, w0_t, MD5C00, MD5S00);
597 MD5_STEP (MD5_Fo, d, a, b, c, w1_t, MD5C01, MD5S01);
598 MD5_STEP (MD5_Fo, c, d, a, b, w2_t, MD5C02, MD5S02);
599 MD5_STEP (MD5_Fo, b, c, d, a, w3_t, MD5C03, MD5S03);
600 MD5_STEP (MD5_Fo, a, b, c, d, w4_t, MD5C04, MD5S00);
601 MD5_STEP (MD5_Fo, d, a, b, c, w5_t, MD5C05, MD5S01);
602 MD5_STEP (MD5_Fo, c, d, a, b, w6_t, MD5C06, MD5S02);
603 MD5_STEP (MD5_Fo, b, c, d, a, w7_t, MD5C07, MD5S03);
604 MD5_STEP (MD5_Fo, a, b, c, d, w8_t, MD5C08, MD5S00);
605 MD5_STEP (MD5_Fo, d, a, b, c, w9_t, MD5C09, MD5S01);
606 MD5_STEP (MD5_Fo, c, d, a, b, wa_t, MD5C0a, MD5S02);
607 MD5_STEP (MD5_Fo, b, c, d, a, wb_t, MD5C0b, MD5S03);
608 MD5_STEP (MD5_Fo, a, b, c, d, wc_t, MD5C0c, MD5S00);
609 MD5_STEP (MD5_Fo, d, a, b, c, wd_t, MD5C0d, MD5S01);
610 MD5_STEP (MD5_Fo, c, d, a, b, we_t, MD5C0e, MD5S02);
611 MD5_STEP (MD5_Fo, b, c, d, a, wf_t, MD5C0f, MD5S03);
613 MD5_STEP (MD5_Go, a, b, c, d, w1_t, MD5C10, MD5S10);
614 MD5_STEP (MD5_Go, d, a, b, c, w6_t, MD5C11, MD5S11);
615 MD5_STEP (MD5_Go, c, d, a, b, wb_t, MD5C12, MD5S12);
616 MD5_STEP (MD5_Go, b, c, d, a, w0_t, MD5C13, MD5S13);
617 MD5_STEP (MD5_Go, a, b, c, d, w5_t, MD5C14, MD5S10);
618 MD5_STEP (MD5_Go, d, a, b, c, wa_t, MD5C15, MD5S11);
619 MD5_STEP (MD5_Go, c, d, a, b, wf_t, MD5C16, MD5S12);
620 MD5_STEP (MD5_Go, b, c, d, a, w4_t, MD5C17, MD5S13);
621 MD5_STEP (MD5_Go, a, b, c, d, w9_t, MD5C18, MD5S10);
622 MD5_STEP (MD5_Go, d, a, b, c, we_t, MD5C19, MD5S11);
623 MD5_STEP (MD5_Go, c, d, a, b, w3_t, MD5C1a, MD5S12);
624 MD5_STEP (MD5_Go, b, c, d, a, w8_t, MD5C1b, MD5S13);
625 MD5_STEP (MD5_Go, a, b, c, d, wd_t, MD5C1c, MD5S10);
626 MD5_STEP (MD5_Go, d, a, b, c, w2_t, MD5C1d, MD5S11);
627 MD5_STEP (MD5_Go, c, d, a, b, w7_t, MD5C1e, MD5S12);
628 MD5_STEP (MD5_Go, b, c, d, a, wc_t, MD5C1f, MD5S13);
630 MD5_STEP (MD5_H , a, b, c, d, w5_t, MD5C20, MD5S20);
631 MD5_STEP (MD5_H , d, a, b, c, w8_t, MD5C21, MD5S21);
632 MD5_STEP (MD5_H , c, d, a, b, wb_t, MD5C22, MD5S22);
633 MD5_STEP (MD5_H , b, c, d, a, we_t, MD5C23, MD5S23);
634 MD5_STEP (MD5_H , a, b, c, d, w1_t, MD5C24, MD5S20);
635 MD5_STEP (MD5_H , d, a, b, c, w4_t, MD5C25, MD5S21);
636 MD5_STEP (MD5_H , c, d, a, b, w7_t, MD5C26, MD5S22);
637 MD5_STEP (MD5_H , b, c, d, a, wa_t, MD5C27, MD5S23);
638 MD5_STEP (MD5_H , a, b, c, d, wd_t, MD5C28, MD5S20);
639 MD5_STEP (MD5_H , d, a, b, c, w0_t, MD5C29, MD5S21);
640 MD5_STEP (MD5_H , c, d, a, b, w3_t, MD5C2a, MD5S22);
641 MD5_STEP (MD5_H , b, c, d, a, w6_t, MD5C2b, MD5S23);
642 MD5_STEP (MD5_H , a, b, c, d, w9_t, MD5C2c, MD5S20);
643 MD5_STEP (MD5_H , d, a, b, c, wc_t, MD5C2d, MD5S21);
644 MD5_STEP (MD5_H , c, d, a, b, wf_t, MD5C2e, MD5S22);
645 MD5_STEP (MD5_H , b, c, d, a, w2_t, MD5C2f, MD5S23);
647 MD5_STEP (MD5_I , a, b, c, d, w0_t, MD5C30, MD5S30);
648 MD5_STEP (MD5_I , d, a, b, c, w7_t, MD5C31, MD5S31);
649 MD5_STEP (MD5_I , c, d, a, b, we_t, MD5C32, MD5S32);
650 MD5_STEP (MD5_I , b, c, d, a, w5_t, MD5C33, MD5S33);
651 MD5_STEP (MD5_I , a, b, c, d, wc_t, MD5C34, MD5S30);
652 MD5_STEP (MD5_I , d, a, b, c, w3_t, MD5C35, MD5S31);
653 MD5_STEP (MD5_I , c, d, a, b, wa_t, MD5C36, MD5S32);
654 MD5_STEP (MD5_I , b, c, d, a, w1_t, MD5C37, MD5S33);
655 MD5_STEP (MD5_I , a, b, c, d, w8_t, MD5C38, MD5S30);
656 MD5_STEP (MD5_I , d, a, b, c, wf_t, MD5C39, MD5S31);
657 MD5_STEP (MD5_I , c, d, a, b, w6_t, MD5C3a, MD5S32);
658 MD5_STEP (MD5_I , b, c, d, a, wd_t, MD5C3b, MD5S33);
659 MD5_STEP (MD5_I , a, b, c, d, w4_t, MD5C3c, MD5S30);
660 MD5_STEP (MD5_I , d, a, b, c, wb_t, MD5C3d, MD5S31);
661 MD5_STEP (MD5_I , c, d, a, b, w2_t, MD5C3e, MD5S32);
662 MD5_STEP (MD5_I , b, c, d, a, w9_t, MD5C3f, MD5S33);
673 __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)
677 __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)