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"
33 #define VECT_COMPARE_S "check_single_vect1_comp4.c"
34 #define VECT_COMPARE_M "check_multi_vect1_comp4.c"
38 #define VECT_COMPARE_S "check_single_vect2_comp4.c"
39 #define VECT_COMPARE_M "check_multi_vect2_comp4.c"
43 #define VECT_COMPARE_S "check_single_vect4_comp4.c"
44 #define VECT_COMPARE_M "check_multi_vect4_comp4.c"
47 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04900_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
53 const u32 lid = get_local_id (0);
59 const u32 gid = get_global_id (0);
61 if (gid >= gid_max) return;
65 wordl0[0] = pws[gid].i[ 0];
66 wordl0[1] = pws[gid].i[ 1];
67 wordl0[2] = pws[gid].i[ 2];
68 wordl0[3] = pws[gid].i[ 3];
72 wordl1[0] = pws[gid].i[ 4];
73 wordl1[1] = pws[gid].i[ 5];
74 wordl1[2] = pws[gid].i[ 6];
75 wordl1[3] = pws[gid].i[ 7];
91 const u32 pw_l_len = pws[gid].pw_len;
93 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
95 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
104 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
105 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
106 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
107 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
111 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
112 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
113 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
114 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
130 const u32 salt_len = salt_bufs[salt_pos].salt_len;
136 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
138 const u32 pw_r_len = combs_buf[il_pos].pw_len;
140 const u32 pw_len = pw_l_len + pw_r_len;
144 wordr0[0] = combs_buf[il_pos].i[0];
145 wordr0[1] = combs_buf[il_pos].i[1];
146 wordr0[2] = combs_buf[il_pos].i[2];
147 wordr0[3] = combs_buf[il_pos].i[3];
151 wordr1[0] = combs_buf[il_pos].i[4];
152 wordr1[1] = combs_buf[il_pos].i[5];
153 wordr1[2] = combs_buf[il_pos].i[6];
154 wordr1[3] = combs_buf[il_pos].i[7];
170 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
172 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
177 w0_t[0] = wordl0[0] | wordr0[0];
178 w0_t[1] = wordl0[1] | wordr0[1];
179 w0_t[2] = wordl0[2] | wordr0[2];
180 w0_t[3] = wordl0[3] | wordr0[3];
184 w1_t[0] = wordl1[0] | wordr1[0];
185 w1_t[1] = wordl1[1] | wordr1[1];
186 w1_t[2] = wordl1[2] | wordr1[2];
187 w1_t[3] = wordl1[3] | wordr1[3];
191 w2_t[0] = wordl2[0] | wordr2[0];
192 w2_t[1] = wordl2[1] | wordr2[1];
193 w2_t[2] = wordl2[2] | wordr2[2];
194 w2_t[3] = wordl2[3] | wordr2[3];
198 w3_t[0] = wordl3[0] | wordr3[0];
199 w3_t[1] = wordl3[1] | wordr3[1];
207 switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, salt_len);
209 w0_t[0] |= salt_buf0[0];
210 w0_t[1] |= salt_buf0[1];
211 w0_t[2] |= salt_buf0[2];
212 w0_t[3] |= salt_buf0[3];
213 w1_t[0] |= salt_buf1[0];
214 w1_t[1] |= salt_buf1[1];
215 w1_t[2] |= salt_buf1[2];
216 w1_t[3] |= salt_buf1[3];
217 w2_t[0] |= salt_buf2[0];
218 w2_t[1] |= salt_buf2[1];
219 w2_t[2] |= salt_buf2[2];
220 w2_t[3] |= salt_buf2[3];
221 w3_t[0] |= salt_buf3[0];
222 w3_t[1] |= salt_buf3[1];
223 w3_t[2] |= salt_buf3[2];
224 w3_t[3] |= salt_buf3[3];
232 s0[0] = salt_buf0[0];
233 s0[1] = salt_buf0[1];
234 s0[2] = salt_buf0[2];
235 s0[3] = salt_buf0[3];
239 s1[0] = salt_buf1[0];
240 s1[1] = salt_buf1[1];
241 s1[2] = salt_buf1[2];
242 s1[3] = salt_buf1[3];
258 switch_buffer_by_offset (s0, s1, s2, s3, salt_len + pw_len);
277 const u32 pw_salt_len = salt_len + pw_len + salt_len;
279 append_0x80_4 (w0_t, w1_t, w2_t, w3_t, pw_salt_len);
281 u32x w0 = swap_workaround (w0_t[0]);
282 u32x w1 = swap_workaround (w0_t[1]);
283 u32x w2 = swap_workaround (w0_t[2]);
284 u32x w3 = swap_workaround (w0_t[3]);
285 u32x w4 = swap_workaround (w1_t[0]);
286 u32x w5 = swap_workaround (w1_t[1]);
287 u32x w6 = swap_workaround (w1_t[2]);
288 u32x w7 = swap_workaround (w1_t[3]);
289 u32x w8 = swap_workaround (w2_t[0]);
290 u32x w9 = swap_workaround (w2_t[1]);
291 u32x wa = swap_workaround (w2_t[2]);
292 u32x wb = swap_workaround (w2_t[3]);
293 u32x wc = swap_workaround (w3_t[0]);
294 u32x wd = swap_workaround (w3_t[1]);
296 u32x wf = pw_salt_len * 8;
311 SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0);
312 SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1);
313 SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2);
314 SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3);
315 SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4);
316 SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5);
317 SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6);
318 SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7);
319 SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8);
320 SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9);
321 SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa);
322 SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb);
323 SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc);
324 SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd);
325 SHA1_STEP (SHA1_F0o, b, c, d, e, a, we);
326 SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf);
327 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0);
328 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1);
329 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2);
330 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3);
335 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4);
336 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5);
337 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6);
338 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7);
339 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8);
340 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9);
341 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa);
342 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb);
343 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc);
344 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd);
345 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we);
346 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf);
347 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0);
348 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1);
349 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2);
350 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3);
351 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4);
352 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5);
353 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6);
354 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7);
359 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8);
360 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9);
361 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa);
362 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb);
363 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc);
364 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd);
365 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we);
366 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf);
367 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0);
368 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1);
369 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2);
370 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3);
371 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4);
372 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5);
373 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6);
374 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7);
375 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8);
376 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9);
377 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa);
378 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb);
383 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc);
384 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd);
385 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we);
386 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf);
387 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0);
388 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1);
389 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2);
390 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3);
391 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4);
392 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5);
393 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6);
394 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7);
395 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8);
396 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9);
397 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa);
398 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb);
399 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc);
400 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd);
401 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we);
402 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf);
409 #include VECT_COMPARE_M
413 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04900_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)
417 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04900_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)
421 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04900_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 combs_cnt, const u32 digests_cnt, const u32 digests_offset, const u32 combs_mode, const u32 gid_max)
427 const u32 lid = get_local_id (0);
433 const u32 gid = get_global_id (0);
435 if (gid >= gid_max) return;
439 wordl0[0] = pws[gid].i[ 0];
440 wordl0[1] = pws[gid].i[ 1];
441 wordl0[2] = pws[gid].i[ 2];
442 wordl0[3] = pws[gid].i[ 3];
446 wordl1[0] = pws[gid].i[ 4];
447 wordl1[1] = pws[gid].i[ 5];
448 wordl1[2] = pws[gid].i[ 6];
449 wordl1[3] = pws[gid].i[ 7];
465 const u32 pw_l_len = pws[gid].pw_len;
467 if (combs_mode == COMBINATOR_MODE_BASE_RIGHT)
469 switch_buffer_by_offset (wordl0, wordl1, wordl2, wordl3, combs_buf[0].pw_len);
478 salt_buf0[0] = salt_bufs[salt_pos].salt_buf[ 0];
479 salt_buf0[1] = salt_bufs[salt_pos].salt_buf[ 1];
480 salt_buf0[2] = salt_bufs[salt_pos].salt_buf[ 2];
481 salt_buf0[3] = salt_bufs[salt_pos].salt_buf[ 3];
485 salt_buf1[0] = salt_bufs[salt_pos].salt_buf[ 4];
486 salt_buf1[1] = salt_bufs[salt_pos].salt_buf[ 5];
487 salt_buf1[2] = salt_bufs[salt_pos].salt_buf[ 6];
488 salt_buf1[3] = salt_bufs[salt_pos].salt_buf[ 7];
504 const u32 salt_len = salt_bufs[salt_pos].salt_len;
510 const u32 search[4] =
512 digests_buf[digests_offset].digest_buf[DGST_R0],
513 digests_buf[digests_offset].digest_buf[DGST_R1],
514 digests_buf[digests_offset].digest_buf[DGST_R2],
515 digests_buf[digests_offset].digest_buf[DGST_R3]
522 const u32 e_rev = rotl32 (search[1], 2u);
528 for (u32 il_pos = 0; il_pos < combs_cnt; il_pos++)
530 const u32 pw_r_len = combs_buf[il_pos].pw_len;
532 const u32 pw_len = pw_l_len + pw_r_len;
536 wordr0[0] = combs_buf[il_pos].i[0];
537 wordr0[1] = combs_buf[il_pos].i[1];
538 wordr0[2] = combs_buf[il_pos].i[2];
539 wordr0[3] = combs_buf[il_pos].i[3];
543 wordr1[0] = combs_buf[il_pos].i[4];
544 wordr1[1] = combs_buf[il_pos].i[5];
545 wordr1[2] = combs_buf[il_pos].i[6];
546 wordr1[3] = combs_buf[il_pos].i[7];
562 if (combs_mode == COMBINATOR_MODE_BASE_LEFT)
564 switch_buffer_by_offset (wordr0, wordr1, wordr2, wordr3, pw_l_len);
569 w0_t[0] = wordl0[0] | wordr0[0];
570 w0_t[1] = wordl0[1] | wordr0[1];
571 w0_t[2] = wordl0[2] | wordr0[2];
572 w0_t[3] = wordl0[3] | wordr0[3];
576 w1_t[0] = wordl1[0] | wordr1[0];
577 w1_t[1] = wordl1[1] | wordr1[1];
578 w1_t[2] = wordl1[2] | wordr1[2];
579 w1_t[3] = wordl1[3] | wordr1[3];
583 w2_t[0] = wordl2[0] | wordr2[0];
584 w2_t[1] = wordl2[1] | wordr2[1];
585 w2_t[2] = wordl2[2] | wordr2[2];
586 w2_t[3] = wordl2[3] | wordr2[3];
590 w3_t[0] = wordl3[0] | wordr3[0];
591 w3_t[1] = wordl3[1] | wordr3[1];
599 switch_buffer_by_offset (w0_t, w1_t, w2_t, w3_t, salt_len);
601 w0_t[0] |= salt_buf0[0];
602 w0_t[1] |= salt_buf0[1];
603 w0_t[2] |= salt_buf0[2];
604 w0_t[3] |= salt_buf0[3];
605 w1_t[0] |= salt_buf1[0];
606 w1_t[1] |= salt_buf1[1];
607 w1_t[2] |= salt_buf1[2];
608 w1_t[3] |= salt_buf1[3];
609 w2_t[0] |= salt_buf2[0];
610 w2_t[1] |= salt_buf2[1];
611 w2_t[2] |= salt_buf2[2];
612 w2_t[3] |= salt_buf2[3];
613 w3_t[0] |= salt_buf3[0];
614 w3_t[1] |= salt_buf3[1];
615 w3_t[2] |= salt_buf3[2];
616 w3_t[3] |= salt_buf3[3];
624 s0[0] = salt_buf0[0];
625 s0[1] = salt_buf0[1];
626 s0[2] = salt_buf0[2];
627 s0[3] = salt_buf0[3];
631 s1[0] = salt_buf1[0];
632 s1[1] = salt_buf1[1];
633 s1[2] = salt_buf1[2];
634 s1[3] = salt_buf1[3];
650 switch_buffer_by_offset (s0, s1, s2, s3, salt_len + pw_len);
669 const u32 pw_salt_len = salt_len + pw_len + salt_len;
671 append_0x80_4 (w0_t, w1_t, w2_t, w3_t, pw_salt_len);
673 u32x w0 = swap_workaround (w0_t[0]);
674 u32x w1 = swap_workaround (w0_t[1]);
675 u32x w2 = swap_workaround (w0_t[2]);
676 u32x w3 = swap_workaround (w0_t[3]);
677 u32x w4 = swap_workaround (w1_t[0]);
678 u32x w5 = swap_workaround (w1_t[1]);
679 u32x w6 = swap_workaround (w1_t[2]);
680 u32x w7 = swap_workaround (w1_t[3]);
681 u32x w8 = swap_workaround (w2_t[0]);
682 u32x w9 = swap_workaround (w2_t[1]);
683 u32x wa = swap_workaround (w2_t[2]);
684 u32x wb = swap_workaround (w2_t[3]);
685 u32x wc = swap_workaround (w3_t[0]);
686 u32x wd = swap_workaround (w3_t[1]);
688 u32x wf = pw_salt_len * 8;
703 SHA1_STEP (SHA1_F0o, a, b, c, d, e, w0);
704 SHA1_STEP (SHA1_F0o, e, a, b, c, d, w1);
705 SHA1_STEP (SHA1_F0o, d, e, a, b, c, w2);
706 SHA1_STEP (SHA1_F0o, c, d, e, a, b, w3);
707 SHA1_STEP (SHA1_F0o, b, c, d, e, a, w4);
708 SHA1_STEP (SHA1_F0o, a, b, c, d, e, w5);
709 SHA1_STEP (SHA1_F0o, e, a, b, c, d, w6);
710 SHA1_STEP (SHA1_F0o, d, e, a, b, c, w7);
711 SHA1_STEP (SHA1_F0o, c, d, e, a, b, w8);
712 SHA1_STEP (SHA1_F0o, b, c, d, e, a, w9);
713 SHA1_STEP (SHA1_F0o, a, b, c, d, e, wa);
714 SHA1_STEP (SHA1_F0o, e, a, b, c, d, wb);
715 SHA1_STEP (SHA1_F0o, d, e, a, b, c, wc);
716 SHA1_STEP (SHA1_F0o, c, d, e, a, b, wd);
717 SHA1_STEP (SHA1_F0o, b, c, d, e, a, we);
718 SHA1_STEP (SHA1_F0o, a, b, c, d, e, wf);
719 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F0o, e, a, b, c, d, w0);
720 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F0o, d, e, a, b, c, w1);
721 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F0o, c, d, e, a, b, w2);
722 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F0o, b, c, d, e, a, w3);
727 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w4);
728 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w5);
729 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w6);
730 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w7);
731 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w8);
732 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w9);
733 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wa);
734 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wb);
735 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wc);
736 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wd);
737 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, we);
738 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wf);
739 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w0);
740 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w1);
741 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w2);
742 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w3);
743 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w4);
744 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w5);
745 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w6);
746 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w7);
751 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w8);
752 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w9);
753 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wa);
754 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wb);
755 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wc);
756 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, wd);
757 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, we);
758 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, wf);
759 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w0);
760 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w1);
761 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w2);
762 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w3);
763 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w4);
764 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, w5);
765 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, w6);
766 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F2o, a, b, c, d, e, w7);
767 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F2o, e, a, b, c, d, w8);
768 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F2o, d, e, a, b, c, w9);
769 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F2o, c, d, e, a, b, wa);
770 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F2o, b, c, d, e, a, wb);
775 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wc);
776 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wd);
777 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, we);
778 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, wf);
779 w0 = rotl32 ((wd ^ w8 ^ w2 ^ w0), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w0);
780 w1 = rotl32 ((we ^ w9 ^ w3 ^ w1), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w1);
781 w2 = rotl32 ((wf ^ wa ^ w4 ^ w2), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w2);
782 w3 = rotl32 ((w0 ^ wb ^ w5 ^ w3), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w3);
783 w4 = rotl32 ((w1 ^ wc ^ w6 ^ w4), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w4);
784 w5 = rotl32 ((w2 ^ wd ^ w7 ^ w5), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, w5);
785 w6 = rotl32 ((w3 ^ we ^ w8 ^ w6), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, w6);
786 w7 = rotl32 ((w4 ^ wf ^ w9 ^ w7), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, w7);
787 w8 = rotl32 ((w5 ^ w0 ^ wa ^ w8), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, w8);
788 w9 = rotl32 ((w6 ^ w1 ^ wb ^ w9), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, w9);
789 wa = rotl32 ((w7 ^ w2 ^ wc ^ wa), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wa);
790 wb = rotl32 ((w8 ^ w3 ^ wd ^ wb), 1u); SHA1_STEP (SHA1_F1, a, b, c, d, e, wb);
792 if (allx (e != e_rev)) continue;
794 wc = rotl32 ((w9 ^ w4 ^ we ^ wc), 1u); SHA1_STEP (SHA1_F1, e, a, b, c, d, wc);
795 wd = rotl32 ((wa ^ w5 ^ wf ^ wd), 1u); SHA1_STEP (SHA1_F1, d, e, a, b, c, wd);
796 we = rotl32 ((wb ^ w6 ^ w0 ^ we), 1u); SHA1_STEP (SHA1_F1, c, d, e, a, b, we);
797 wf = rotl32 ((wc ^ w7 ^ w1 ^ wf), 1u); SHA1_STEP (SHA1_F1, b, c, d, e, a, wf);
804 #include VECT_COMPARE_S
808 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04900_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)
812 __kernel void __attribute__((reqd_work_group_size (64, 1, 1))) m04900_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)