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"
25 #define uint_to_hex_lower8(i) l_bin2asc[(i)]
27 __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)
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;
63 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
64 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
65 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
66 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
70 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
71 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
72 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
73 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
89 const u32 salt_len = salt_bufs[salt_pos].salt_len;
91 const u32 pw_salt_len = 32 + salt_len;
97 __local u32 l_bin2asc[256];
99 const u32 lid4 = lid * 4;
101 const u32 lid40 = lid4 + 0;
102 const u32 lid41 = lid4 + 1;
103 const u32 lid42 = lid4 + 2;
104 const u32 lid43 = lid4 + 3;
106 const u32 v400 = (lid40 >> 0) & 15;
107 const u32 v401 = (lid40 >> 4) & 15;
108 const u32 v410 = (lid41 >> 0) & 15;
109 const u32 v411 = (lid41 >> 4) & 15;
110 const u32 v420 = (lid42 >> 0) & 15;
111 const u32 v421 = (lid42 >> 4) & 15;
112 const u32 v430 = (lid43 >> 0) & 15;
113 const u32 v431 = (lid43 >> 4) & 15;
115 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
116 | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
117 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
118 | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
119 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
120 | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
121 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
122 | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
124 barrier (CLK_LOCAL_MEM_FENCE);
126 if (gid >= gid_max) return;
132 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
162 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
164 append_0x80_2x4 (w0, w1, out_len);
173 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
174 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
175 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
176 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
177 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
178 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
179 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
180 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
181 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
182 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
183 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
184 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
185 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
186 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
187 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
188 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
190 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
191 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
192 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
193 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
194 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
195 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
196 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
197 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
198 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
199 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
200 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
201 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
202 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
203 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
204 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
205 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
207 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
208 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
209 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
210 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
211 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
212 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
213 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
214 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
215 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
216 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
217 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
218 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
219 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
220 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
221 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
222 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
224 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
225 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
226 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
227 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
228 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
229 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
230 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
231 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
232 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
233 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
234 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
235 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
236 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
237 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
238 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
239 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
251 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
252 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
253 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
254 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
255 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
256 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
257 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
258 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
259 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
260 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
261 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
262 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
263 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
264 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
265 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
266 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
268 w2_t[0] = 0x00000080;
282 switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, salt_len);
284 w3_t[2] = pw_salt_len * 8;
286 w0_t[0] |= salt_buf0[0];
287 w0_t[1] |= salt_buf0[1];
288 w0_t[2] |= salt_buf0[2];
289 w0_t[3] |= salt_buf0[3];
290 w1_t[0] |= salt_buf1[0];
291 w1_t[1] |= salt_buf1[1];
292 w1_t[2] |= salt_buf1[2];
293 w1_t[3] |= salt_buf1[3];
294 w2_t[0] |= salt_buf2[0];
295 w2_t[1] |= salt_buf2[1];
296 w2_t[2] |= salt_buf2[2];
297 w2_t[3] |= salt_buf2[3];
298 w3_t[0] |= salt_buf3[0];
299 w3_t[1] |= salt_buf3[1];
300 w3_t[2] |= salt_buf3[2];
301 w3_t[3] |= salt_buf3[3];
312 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
313 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
314 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
315 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
316 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
317 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
318 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
319 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
320 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
321 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
322 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
323 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
324 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
325 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
326 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
327 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
329 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
330 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
331 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
332 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
333 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
334 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
335 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
336 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
337 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
338 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
339 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
340 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
341 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
342 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
343 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
344 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
346 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
347 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
348 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
349 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
350 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
351 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
352 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
353 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
354 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
355 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
356 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
357 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
358 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
359 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
360 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
361 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
363 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
364 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
365 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
366 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
367 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
368 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
369 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
370 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
371 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
372 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
373 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
374 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
375 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
376 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
377 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
378 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
389 __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)
393 __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)
397 __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)
403 const u32 lid = get_local_id (0);
409 const u32 gid = get_global_id (0);
413 pw_buf0[0] = pws[gid].i[ 0];
414 pw_buf0[1] = pws[gid].i[ 1];
415 pw_buf0[2] = pws[gid].i[ 2];
416 pw_buf0[3] = pws[gid].i[ 3];
420 pw_buf1[0] = pws[gid].i[ 4];
421 pw_buf1[1] = pws[gid].i[ 5];
422 pw_buf1[2] = pws[gid].i[ 6];
423 pw_buf1[3] = pws[gid].i[ 7];
425 const u32 pw_len = pws[gid].pw_len;
433 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
434 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
435 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
436 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
440 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
441 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
442 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
443 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
459 const u32 salt_len = salt_bufs[salt_pos].salt_len;
461 const u32 pw_salt_len = 32 + salt_len;
467 const u32 search[4] =
469 digests_buf[digests_offset].digest_buf[DGST_R0],
470 digests_buf[digests_offset].digest_buf[DGST_R1],
471 digests_buf[digests_offset].digest_buf[DGST_R2],
472 digests_buf[digests_offset].digest_buf[DGST_R3]
479 __local u32 l_bin2asc[256];
481 const u32 lid4 = lid * 4;
483 const u32 lid40 = lid4 + 0;
484 const u32 lid41 = lid4 + 1;
485 const u32 lid42 = lid4 + 2;
486 const u32 lid43 = lid4 + 3;
488 const u32 v400 = (lid40 >> 0) & 15;
489 const u32 v401 = (lid40 >> 4) & 15;
490 const u32 v410 = (lid41 >> 0) & 15;
491 const u32 v411 = (lid41 >> 4) & 15;
492 const u32 v420 = (lid42 >> 0) & 15;
493 const u32 v421 = (lid42 >> 4) & 15;
494 const u32 v430 = (lid43 >> 0) & 15;
495 const u32 v431 = (lid43 >> 4) & 15;
497 l_bin2asc[lid40] = ((v400 < 10) ? '0' + v400 : 'a' - 10 + v400) << 8
498 | ((v401 < 10) ? '0' + v401 : 'a' - 10 + v401) << 0;
499 l_bin2asc[lid41] = ((v410 < 10) ? '0' + v410 : 'a' - 10 + v410) << 8
500 | ((v411 < 10) ? '0' + v411 : 'a' - 10 + v411) << 0;
501 l_bin2asc[lid42] = ((v420 < 10) ? '0' + v420 : 'a' - 10 + v420) << 8
502 | ((v421 < 10) ? '0' + v421 : 'a' - 10 + v421) << 0;
503 l_bin2asc[lid43] = ((v430 < 10) ? '0' + v430 : 'a' - 10 + v430) << 8
504 | ((v431 < 10) ? '0' + v431 : 'a' - 10 + v431) << 0;
506 barrier (CLK_LOCAL_MEM_FENCE);
508 if (gid >= gid_max) return;
514 for (u32 il_pos = 0; il_pos < rules_cnt; il_pos++)
544 const u32 out_len = apply_rules (rules_buf[il_pos].cmds, w0, w1, pw_len);
546 append_0x80_2x4 (w0, w1, out_len);
555 MD5_STEP (MD5_Fo, a, b, c, d, w0[0], MD5C00, MD5S00);
556 MD5_STEP (MD5_Fo, d, a, b, c, w0[1], MD5C01, MD5S01);
557 MD5_STEP (MD5_Fo, c, d, a, b, w0[2], MD5C02, MD5S02);
558 MD5_STEP (MD5_Fo, b, c, d, a, w0[3], MD5C03, MD5S03);
559 MD5_STEP (MD5_Fo, a, b, c, d, w1[0], MD5C04, MD5S00);
560 MD5_STEP (MD5_Fo, d, a, b, c, w1[1], MD5C05, MD5S01);
561 MD5_STEP (MD5_Fo, c, d, a, b, w1[2], MD5C06, MD5S02);
562 MD5_STEP (MD5_Fo, b, c, d, a, w1[3], MD5C07, MD5S03);
563 MD5_STEP (MD5_Fo, a, b, c, d, w2[0], MD5C08, MD5S00);
564 MD5_STEP (MD5_Fo, d, a, b, c, w2[1], MD5C09, MD5S01);
565 MD5_STEP (MD5_Fo, c, d, a, b, w2[2], MD5C0a, MD5S02);
566 MD5_STEP (MD5_Fo, b, c, d, a, w2[3], MD5C0b, MD5S03);
567 MD5_STEP (MD5_Fo, a, b, c, d, w3[0], MD5C0c, MD5S00);
568 MD5_STEP (MD5_Fo, d, a, b, c, w3[1], MD5C0d, MD5S01);
569 MD5_STEP (MD5_Fo, c, d, a, b, w3[2], MD5C0e, MD5S02);
570 MD5_STEP (MD5_Fo, b, c, d, a, w3[3], MD5C0f, MD5S03);
572 MD5_STEP (MD5_Go, a, b, c, d, w0[1], MD5C10, MD5S10);
573 MD5_STEP (MD5_Go, d, a, b, c, w1[2], MD5C11, MD5S11);
574 MD5_STEP (MD5_Go, c, d, a, b, w2[3], MD5C12, MD5S12);
575 MD5_STEP (MD5_Go, b, c, d, a, w0[0], MD5C13, MD5S13);
576 MD5_STEP (MD5_Go, a, b, c, d, w1[1], MD5C14, MD5S10);
577 MD5_STEP (MD5_Go, d, a, b, c, w2[2], MD5C15, MD5S11);
578 MD5_STEP (MD5_Go, c, d, a, b, w3[3], MD5C16, MD5S12);
579 MD5_STEP (MD5_Go, b, c, d, a, w1[0], MD5C17, MD5S13);
580 MD5_STEP (MD5_Go, a, b, c, d, w2[1], MD5C18, MD5S10);
581 MD5_STEP (MD5_Go, d, a, b, c, w3[2], MD5C19, MD5S11);
582 MD5_STEP (MD5_Go, c, d, a, b, w0[3], MD5C1a, MD5S12);
583 MD5_STEP (MD5_Go, b, c, d, a, w2[0], MD5C1b, MD5S13);
584 MD5_STEP (MD5_Go, a, b, c, d, w3[1], MD5C1c, MD5S10);
585 MD5_STEP (MD5_Go, d, a, b, c, w0[2], MD5C1d, MD5S11);
586 MD5_STEP (MD5_Go, c, d, a, b, w1[3], MD5C1e, MD5S12);
587 MD5_STEP (MD5_Go, b, c, d, a, w3[0], MD5C1f, MD5S13);
589 MD5_STEP (MD5_H , a, b, c, d, w1[1], MD5C20, MD5S20);
590 MD5_STEP (MD5_H , d, a, b, c, w2[0], MD5C21, MD5S21);
591 MD5_STEP (MD5_H , c, d, a, b, w2[3], MD5C22, MD5S22);
592 MD5_STEP (MD5_H , b, c, d, a, w3[2], MD5C23, MD5S23);
593 MD5_STEP (MD5_H , a, b, c, d, w0[1], MD5C24, MD5S20);
594 MD5_STEP (MD5_H , d, a, b, c, w1[0], MD5C25, MD5S21);
595 MD5_STEP (MD5_H , c, d, a, b, w1[3], MD5C26, MD5S22);
596 MD5_STEP (MD5_H , b, c, d, a, w2[2], MD5C27, MD5S23);
597 MD5_STEP (MD5_H , a, b, c, d, w3[1], MD5C28, MD5S20);
598 MD5_STEP (MD5_H , d, a, b, c, w0[0], MD5C29, MD5S21);
599 MD5_STEP (MD5_H , c, d, a, b, w0[3], MD5C2a, MD5S22);
600 MD5_STEP (MD5_H , b, c, d, a, w1[2], MD5C2b, MD5S23);
601 MD5_STEP (MD5_H , a, b, c, d, w2[1], MD5C2c, MD5S20);
602 MD5_STEP (MD5_H , d, a, b, c, w3[0], MD5C2d, MD5S21);
603 MD5_STEP (MD5_H , c, d, a, b, w3[3], MD5C2e, MD5S22);
604 MD5_STEP (MD5_H , b, c, d, a, w0[2], MD5C2f, MD5S23);
606 MD5_STEP (MD5_I , a, b, c, d, w0[0], MD5C30, MD5S30);
607 MD5_STEP (MD5_I , d, a, b, c, w1[3], MD5C31, MD5S31);
608 MD5_STEP (MD5_I , c, d, a, b, w3[2], MD5C32, MD5S32);
609 MD5_STEP (MD5_I , b, c, d, a, w1[1], MD5C33, MD5S33);
610 MD5_STEP (MD5_I , a, b, c, d, w3[0], MD5C34, MD5S30);
611 MD5_STEP (MD5_I , d, a, b, c, w0[3], MD5C35, MD5S31);
612 MD5_STEP (MD5_I , c, d, a, b, w2[2], MD5C36, MD5S32);
613 MD5_STEP (MD5_I , b, c, d, a, w0[1], MD5C37, MD5S33);
614 MD5_STEP (MD5_I , a, b, c, d, w2[0], MD5C38, MD5S30);
615 MD5_STEP (MD5_I , d, a, b, c, w3[3], MD5C39, MD5S31);
616 MD5_STEP (MD5_I , c, d, a, b, w1[2], MD5C3a, MD5S32);
617 MD5_STEP (MD5_I , b, c, d, a, w3[1], MD5C3b, MD5S33);
618 MD5_STEP (MD5_I , a, b, c, d, w1[0], MD5C3c, MD5S30);
619 MD5_STEP (MD5_I , d, a, b, c, w2[3], MD5C3d, MD5S31);
620 MD5_STEP (MD5_I , c, d, a, b, w0[2], MD5C3e, MD5S32);
621 MD5_STEP (MD5_I , b, c, d, a, w2[1], MD5C3f, MD5S33);
633 w0_t[0] = uint_to_hex_lower8 ((a >> 0) & 255) << 0
634 | uint_to_hex_lower8 ((a >> 8) & 255) << 16;
635 w0_t[1] = uint_to_hex_lower8 ((a >> 16) & 255) << 0
636 | uint_to_hex_lower8 ((a >> 24) & 255) << 16;
637 w0_t[2] = uint_to_hex_lower8 ((b >> 0) & 255) << 0
638 | uint_to_hex_lower8 ((b >> 8) & 255) << 16;
639 w0_t[3] = uint_to_hex_lower8 ((b >> 16) & 255) << 0
640 | uint_to_hex_lower8 ((b >> 24) & 255) << 16;
641 w1_t[0] = uint_to_hex_lower8 ((c >> 0) & 255) << 0
642 | uint_to_hex_lower8 ((c >> 8) & 255) << 16;
643 w1_t[1] = uint_to_hex_lower8 ((c >> 16) & 255) << 0
644 | uint_to_hex_lower8 ((c >> 24) & 255) << 16;
645 w1_t[2] = uint_to_hex_lower8 ((d >> 0) & 255) << 0
646 | uint_to_hex_lower8 ((d >> 8) & 255) << 16;
647 w1_t[3] = uint_to_hex_lower8 ((d >> 16) & 255) << 0
648 | uint_to_hex_lower8 ((d >> 24) & 255) << 16;
650 w2_t[0] = 0x00000080;
664 switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, salt_len);
666 w3_t[2] = pw_salt_len * 8;
668 w0_t[0] |= salt_buf0[0];
669 w0_t[1] |= salt_buf0[1];
670 w0_t[2] |= salt_buf0[2];
671 w0_t[3] |= salt_buf0[3];
672 w1_t[0] |= salt_buf1[0];
673 w1_t[1] |= salt_buf1[1];
674 w1_t[2] |= salt_buf1[2];
675 w1_t[3] |= salt_buf1[3];
676 w2_t[0] |= salt_buf2[0];
677 w2_t[1] |= salt_buf2[1];
678 w2_t[2] |= salt_buf2[2];
679 w2_t[3] |= salt_buf2[3];
680 w3_t[0] |= salt_buf3[0];
681 w3_t[1] |= salt_buf3[1];
682 w3_t[2] |= salt_buf3[2];
683 w3_t[3] |= salt_buf3[3];
694 MD5_STEP (MD5_Fo, a, b, c, d, w0_t[0], MD5C00, MD5S00);
695 MD5_STEP (MD5_Fo, d, a, b, c, w0_t[1], MD5C01, MD5S01);
696 MD5_STEP (MD5_Fo, c, d, a, b, w0_t[2], MD5C02, MD5S02);
697 MD5_STEP (MD5_Fo, b, c, d, a, w0_t[3], MD5C03, MD5S03);
698 MD5_STEP (MD5_Fo, a, b, c, d, w1_t[0], MD5C04, MD5S00);
699 MD5_STEP (MD5_Fo, d, a, b, c, w1_t[1], MD5C05, MD5S01);
700 MD5_STEP (MD5_Fo, c, d, a, b, w1_t[2], MD5C06, MD5S02);
701 MD5_STEP (MD5_Fo, b, c, d, a, w1_t[3], MD5C07, MD5S03);
702 MD5_STEP (MD5_Fo, a, b, c, d, w2_t[0], MD5C08, MD5S00);
703 MD5_STEP (MD5_Fo, d, a, b, c, w2_t[1], MD5C09, MD5S01);
704 MD5_STEP (MD5_Fo, c, d, a, b, w2_t[2], MD5C0a, MD5S02);
705 MD5_STEP (MD5_Fo, b, c, d, a, w2_t[3], MD5C0b, MD5S03);
706 MD5_STEP (MD5_Fo, a, b, c, d, w3_t[0], MD5C0c, MD5S00);
707 MD5_STEP (MD5_Fo, d, a, b, c, w3_t[1], MD5C0d, MD5S01);
708 MD5_STEP (MD5_Fo, c, d, a, b, w3_t[2], MD5C0e, MD5S02);
709 MD5_STEP (MD5_Fo, b, c, d, a, w3_t[3], MD5C0f, MD5S03);
711 MD5_STEP (MD5_Go, a, b, c, d, w0_t[1], MD5C10, MD5S10);
712 MD5_STEP (MD5_Go, d, a, b, c, w1_t[2], MD5C11, MD5S11);
713 MD5_STEP (MD5_Go, c, d, a, b, w2_t[3], MD5C12, MD5S12);
714 MD5_STEP (MD5_Go, b, c, d, a, w0_t[0], MD5C13, MD5S13);
715 MD5_STEP (MD5_Go, a, b, c, d, w1_t[1], MD5C14, MD5S10);
716 MD5_STEP (MD5_Go, d, a, b, c, w2_t[2], MD5C15, MD5S11);
717 MD5_STEP (MD5_Go, c, d, a, b, w3_t[3], MD5C16, MD5S12);
718 MD5_STEP (MD5_Go, b, c, d, a, w1_t[0], MD5C17, MD5S13);
719 MD5_STEP (MD5_Go, a, b, c, d, w2_t[1], MD5C18, MD5S10);
720 MD5_STEP (MD5_Go, d, a, b, c, w3_t[2], MD5C19, MD5S11);
721 MD5_STEP (MD5_Go, c, d, a, b, w0_t[3], MD5C1a, MD5S12);
722 MD5_STEP (MD5_Go, b, c, d, a, w2_t[0], MD5C1b, MD5S13);
723 MD5_STEP (MD5_Go, a, b, c, d, w3_t[1], MD5C1c, MD5S10);
724 MD5_STEP (MD5_Go, d, a, b, c, w0_t[2], MD5C1d, MD5S11);
725 MD5_STEP (MD5_Go, c, d, a, b, w1_t[3], MD5C1e, MD5S12);
726 MD5_STEP (MD5_Go, b, c, d, a, w3_t[0], MD5C1f, MD5S13);
728 MD5_STEP (MD5_H , a, b, c, d, w1_t[1], MD5C20, MD5S20);
729 MD5_STEP (MD5_H , d, a, b, c, w2_t[0], MD5C21, MD5S21);
730 MD5_STEP (MD5_H , c, d, a, b, w2_t[3], MD5C22, MD5S22);
731 MD5_STEP (MD5_H , b, c, d, a, w3_t[2], MD5C23, MD5S23);
732 MD5_STEP (MD5_H , a, b, c, d, w0_t[1], MD5C24, MD5S20);
733 MD5_STEP (MD5_H , d, a, b, c, w1_t[0], MD5C25, MD5S21);
734 MD5_STEP (MD5_H , c, d, a, b, w1_t[3], MD5C26, MD5S22);
735 MD5_STEP (MD5_H , b, c, d, a, w2_t[2], MD5C27, MD5S23);
736 MD5_STEP (MD5_H , a, b, c, d, w3_t[1], MD5C28, MD5S20);
737 MD5_STEP (MD5_H , d, a, b, c, w0_t[0], MD5C29, MD5S21);
738 MD5_STEP (MD5_H , c, d, a, b, w0_t[3], MD5C2a, MD5S22);
739 MD5_STEP (MD5_H , b, c, d, a, w1_t[2], MD5C2b, MD5S23);
740 MD5_STEP (MD5_H , a, b, c, d, w2_t[1], MD5C2c, MD5S20);
741 MD5_STEP (MD5_H , d, a, b, c, w3_t[0], MD5C2d, MD5S21);
742 MD5_STEP (MD5_H , c, d, a, b, w3_t[3], MD5C2e, MD5S22);
743 MD5_STEP (MD5_H , b, c, d, a, w0_t[2], MD5C2f, MD5S23);
745 MD5_STEP (MD5_I , a, b, c, d, w0_t[0], MD5C30, MD5S30);
746 MD5_STEP (MD5_I , d, a, b, c, w1_t[3], MD5C31, MD5S31);
747 MD5_STEP (MD5_I , c, d, a, b, w3_t[2], MD5C32, MD5S32);
748 MD5_STEP (MD5_I , b, c, d, a, w1_t[1], MD5C33, MD5S33);
749 MD5_STEP (MD5_I , a, b, c, d, w3_t[0], MD5C34, MD5S30);
750 MD5_STEP (MD5_I , d, a, b, c, w0_t[3], MD5C35, MD5S31);
751 MD5_STEP (MD5_I , c, d, a, b, w2_t[2], MD5C36, MD5S32);
752 MD5_STEP (MD5_I , b, c, d, a, w0_t[1], MD5C37, MD5S33);
753 MD5_STEP (MD5_I , a, b, c, d, w2_t[0], MD5C38, MD5S30);
754 MD5_STEP (MD5_I , d, a, b, c, w3_t[3], MD5C39, MD5S31);
755 MD5_STEP (MD5_I , c, d, a, b, w1_t[2], MD5C3a, MD5S32);
756 MD5_STEP (MD5_I , b, c, d, a, w3_t[1], MD5C3b, MD5S33);
757 MD5_STEP (MD5_I , a, b, c, d, w1_t[0], MD5C3c, MD5S30);
758 MD5_STEP (MD5_I , d, a, b, c, w2_t[3], MD5C3d, MD5S31);
759 MD5_STEP (MD5_I , c, d, a, b, w0_t[2], MD5C3e, MD5S32);
760 MD5_STEP (MD5_I , b, c, d, a, w2_t[1], MD5C3f, MD5S33);
771 __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)
775 __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)